在我遇到很多很多UWP问题之后,其他人无法复制我想尝试.Net Native编译(还没有尝试过)确实为我解决了问题。但我甚至无法用它编译我的应用程序。
1>"C:\Project\\RIVI\RIVI\RIVI.csproj" (Rebuild target) (1) ->
1>(BuildNativePackage target) ->
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : ILTransform : warning ILT0028: Found native library 'C:\Project\\RIVI\RIVI\obj\x64\Debug\ilc\in\sharpdx_direct3d11_1_effects_x86.dll' with unexpected CPU architecture 'x86', while the current build target architecture is set to 'amd64'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegCloseKey' for method 'System.Int32 Interop.mincore.RegCloseKey(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegQueryValueExW' for method 'System.Int32 Interop.mincore.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Byte[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegEnumKeyExW' for method 'System.Int32 Interop.mincore.RegEnumKeyEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.Int32, System.Char*, System.Int32, System.Int32[], System.Text.StringBuilder, System.Int32[], System.Int64[])'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegQueryValueExW' for method 'System.Int32 Interop.mincore.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Int64, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegQueryValueExW' for method 'System.Int32 Interop.mincore.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Int32, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegQueryValueExW' for method 'System.Int32 Interop.mincore.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Char[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegOpenKeyExW' for method 'System.Int32 Interop.mincore.RegOpenKeyEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, System.Int32, Microsoft.Win32.SafeHandles.SafeRegistryHandle)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'api-ms-win-core-registry-l1-1-0.dll!RegQueryInfoKeyW' for method 'System.Int32 Interop.mincore.RegQueryInfoKey(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.Text.StringBuilder, System.Int32[], System.IntPtr, System.Int32, System.Int32[], System.Int32[], System.Int32, System.Int32[], System.Int32[], System.Int32[], System.Int32[])'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
1>
1>
1>"C:\Project\\RIVI\RIVI\RIVI.csproj" (Rebuild target) (1) ->
1>(BuildNativePackage target) ->
1> C:\Users\et49725\.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(731,5): error : Internal compiler error: One or more errors occurred. (Failed to compile interop source code. See the build log for error details.)
1>
1> 38 Warning(s)
1> 1 Error(s)
1>
1>Time Elapsed 00:01:23.91
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
总是说汇编源代码的编译失败。在我的代码中没有提到所提到的互操作方法。我甚至不认为任何引用的包确实使用它们。所以我甚至不知道如何解决这个问题。
我该如何解决?最终我开始使用.Net Native编译。