Redth / ResizetizerNT

Add SVG's and PNG's to your shared Xamarin Project
MIT License
318 stars 31 forks source link

Skia issues when building from command line in .NET 5 RC2 #32

Open follesoe opened 4 years ago

follesoe commented 4 years ago

When building from the command line, using dotnet build to build my WPF project on Windows 10, I get the following error using version 0.1.0:

C:\Users\jonas\.nuget\packages\resizetizer.nt\0.1.0\buildTransitive\Resizetizer.NT.targets(155,3): 
error : One or more errors occurred. (The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
(The type initializer for 'Svg.Skia.SKSvg' threw an exception.) 
[C:\Users\jonas\source\BlueyeDiveBuddy\Blueye.DiveBuddy.WPF\Blueye.DiveBuddy.WPF.csproj]

With version 0.2.0 I get the following error

C:\Users\jonas\.nuget\packages\resizetizer.nt\0.2.0\buildTransitive\Resizetizer.NT.targets(155,3): error : 
One or more errors occurred. 
(Unable to load library 'libSkiaSharp'.) 
(Unable to load library 'libSkiaSharp'.) 
(Unable to load library 'libSkiaSharp'.) 
(Unable to load library 'libSkiaSharp'.) 
(Unable to load library 'libSkiaSharp'.)
 (Unable to load library 'libSkiaSharp'.) 
(Unable to load library 'libSkiaSharp'.) 
[C:\Users\jonas\source\BlueyeDiveBuddy\Blueye.DiveBuddy.WPF\Blueye.DiveBuddy.WPF.csproj]
    12 Warning(s)
    1 Error(s)

Time Elapsed 00:00:05.05
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 ---> System.DllNotFoundException: Unable to load library 'libSkiaSharp'.
   at SkiaSharp.LibraryLoader.LoadLocalLibrary[T](String libraryName)
   at SkiaSharp.SkiaApi.<>c.<.cctor>b__1723_0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.LazyHelper.ThrowException()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at SkiaSharp.SkiaApi.GetSymbol[T](String name)
   at SkiaSharp.SkiaApi.sk_version_get_milestone()
   at SkiaSharp.SkiaSharpVersion.get_Native()
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
   --- End of inner exception stack trace ---
   at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
   at SkiaSharp.SKObject.set_Handle(IntPtr value)
   at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
   at SkiaSharp.SKObject.Dispose(Boolean disposing)
   at SkiaSharp.SKPictureRecorder.Dispose(Boolean disposing)
   at SkiaSharp.SKNativeObject.Finalize()

I can build and run the application from Visual Studio, and image files are generated as expected.

follesoe commented 4 years ago

Tried uninstalling 5.0 RC2, but the problem when building using .NET Core 3.1 from the command line.

follesoe commented 4 years ago

Doing a dotnet publish -c Release works, while dotnet publish -r win-x86 -c Release fails.

Redth commented 3 years ago

@mattleibow I'm guessing I'm not including some lib in the nuget for a certain architecture? can you have a look at this?