I have tried many things before I found costura.fody and I were hoping that would be the solution to create a single file exe of a cefsharp application that I'm doing.
So the help file for costura.fody says to set the copy local to true of the file you want to embed in the solution explorer. Done that.
So the exe got a little bit bigger when I did that but I notice that the size was not even close to cover libcef.dll so I suspected that this file was not embedded.
I tested this by renaming the dll in the output folder and yes I couldn't run the application.
I would really love for this to work but I'm kind of giving up. I was struggling with AppDomain.CurrentDomain.AssemblyResolve to tap into that event but it was never called. Even when defining it in the static constructor to make sure it is started before anything else.
I'm currently using this code:
public static void Main(string args)
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly);
Just to clarify things, I'm using a windows forms project and I'm trying to make it as close to the examples I can find online. I would prefer to just add it in the Form1 constructor.
It should be calling this function
private static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
throw new NotImplementedException();
But it never does.
In the .csproj file tried this snippet.
<CallTarget Targets="Clean" />
<MSBuild Projects="$(SolutionPath)" Targets="Build" Properties="Configuration=Debug;IgnoreRecursion=true" />
<CallTarget Targets="Prebuild" Condition="'%(_IgnoreRecursion.Identity)' != 'true'" />
<Output TaskParameter="Include" ItemName="OutputFiles" />
<EmbeddedResource Include="@(OutputFiles)" Condition="('%(OutputFiles.Extension)' == '.dll' Or '%(OutputFiles.Extension)' == '.pdb')">
<Message Importance="high" Text="Embedding: @(OutputFiles->'%(Filename)%(Extension)', ', ')" />
This embeds the dll's fine. I just wish ResolveAssembly could be called. If it was I could have this code taking care of the lost dll's
Can anyone please help me with this?
Kind regards andla