I created a solution that uses the Costura.Fody nuget package to merge referenced assemblies as embedded resources. I want this so that I can create a single exe for my application. This was working great for a while until I added a reference to SkiaSharp (specifically the nuget packages SkiaSharp and SkiaSharp.Svg). The libSkiaSharp.dll is not embedded and instead built in the startup project folder, and I can't run the program exe on its own unless I keep the dll in the same folder. Is there a way to fix this?
Here's the steps to reproduce this:
1. Create a new WPF project
2. Add the Costura.Fody and Fody nuget packages.
3. Add a file called FodyWeavers.xml with the contents set to this:
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Costura/>
</Weavers>
- Build and run the exe file in the bin/Debug folder. Notice that program will start up even if you move the exe to a new location.
- Add SkiaSharp and SkiaSharp.Svg nuget packages.
- get an svg file and add it to your project directory
add the following code to your MainWindow constructor:
var svg = new SKSvg(); svg.Load("image.svg"); SKCanvas canvas = new SKCanvas(new SKBitmap()); canvas.DrawPicture(svg.Picture);
notice that if you copy the image file and the exe and place in another directory, the exe will not start up. This occurs because it can't find libSkiaSharp.dll.