Using c# in visual studio 2012, I've created a class library FileTube.dll It uses 3 other dll's. I want to make a single dll to contain those thus I can publish my library via nuget. I have tried 3 approaches all failing:
approach 1: In vistual studio, I set the "Embed Interop Assembly" to true, I get this error:
Error 2 Cannot embed interop types from assembly 'DiffieHellman.dll' because it is missing the 'GuidAttribute' attribute DiffieHellman.dll
approach 2: I used ILMergeGUI. It generated the code to use for ILMerge which fails with the error: Object reference not set to an instance of an object. Here is the command:
"C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe"
/ndebug
/copyattrs
/targetplatform:4.0,"C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
/out:"C:\temp\z.dll"
"C:\\FileTube\TestApp\bin\Debug\FileTube.dll"
"C:\\FileTube\TestApp\bin\Debug\DiffieHellman.dll"
"C:\\FileTube\TestApp\bin\Debug\Org.Mentalis.Security.dll"
"C:\\FileTube\TestApp\bin\Debug\Tamir.SharpSSH.dll"
approach 3: I followed this tutorial to use reflection to include the dll assemblies. The difference is that the tutorial has a main executable and is including dll in the executable while I'm trying to include dlls in my dll. so I added the reflection code to the class constructor of my main dll. It compiles but it would fail if I rename that external dll meaning that it's not really loading it.
Any ideas?
You have several options:
OR
OR
AssemblyResolve
handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime...(Answer copied from: How to merge multiple assemblies into one?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With