Hi, I created a UWP project in Xamari, and it can run successfully when debug. But when I change to release and create app packages, it failed. I need help. Thanks!
Environment:Win10 1909,Microsoft Visual Studio Enterprise 2019 Version 16.6.0
- Create new cross platfrom Xamarin project include UWP(Windows 10 version 1903(build 18362)
- Add GemBox.Document for .NET Standard 2.0 library:
- Success when debugging.
- Change debug to release, fail to create App package when publishing
Error message:
Error
70> Processing application code
70> Computing application closure and generating interop code
70> Loading 208 modules…
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘gdiplus.dll!GdipEmfToWmfBits’ for method ‘System.UInt32 ..(System.IntPtr, System.UInt32, 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘gdi32.dll!SetMetaFileBitsEx’ for method ‘System.IntPtr ..(System.UInt32, System.Byte)’. 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘gdi32.dll!CopyMetaFile’ for method ‘System.IntPtr ..(System.IntPtr, System.String)’. 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘gdi32.dll!DeleteMetaFile’ for method ‘System.Boolean ..(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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘gdi32.dll!DeleteEnhMetaFile’ for method ‘System.Boolean ..(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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘libdl!dlerror’ for method ‘System.IntPtr Net.Pkcs11Interop.Common.NativeMethods.dlerror()’. 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘libdl!dlopen’ for method ‘System.IntPtr Net.Pkcs11Interop.Common.NativeMethods.dlopen(System.String, 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘libdl!dlclose’ for method ‘System.Int32 Net.Pkcs11Interop.Common.NativeMethods.dlclose(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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘libdl!dlsym’ for method ‘System.IntPtr Net.Pkcs11Interop.Common.NativeMethods.dlsym(System.IntPtr, System.String)’. 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.…
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘__Internal!C_VerifyFinal’ for method ‘System.UInt64 Net.Pkcs11Interop.LowLevelAPI81.Delegates.NativeMethods.C_VerifyFinal(System.UInt64, System.Byte, System.UInt64)’. 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.
…(Deleted)
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘__Internal!C_CancelFunction’ for method ‘System.UInt32 Net.Pkcs11Interop.LowLevelAPI40.Delegates.NativeMethods.C_CancelFunction(System.UInt32)’. 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.
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method ‘__Internal!C_WaitForSlotEvent’ for method ‘System.UInt32 Net.Pkcs11Interop.LowLevelAPI40.Delegates.NativeMethods.C_WaitForSlotEvent(System.UInt32, System.UInt32, 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.
70> Generating code…
70> Interop code generated.
70> Generating serialization code
70> Compiling interop code
70>C:\Users\HMY.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\too
ls\Microsoft.NetNative.targets(801,5): error : ILT0014: Failed to compile interop source code. See the build log for error details.