1

I developed a small project using C# and got everything working perfectly. The only problem is that this app will be regularly sent via emails, therefore I'm trying to assemble all the files as one executable. The user will only have to open and see one executable, which will load the needed files and start the application.

The app does not use any external libraries. The only .dll file is for the IWshRuntimeLibrary.

The files that need to be assembled:

Files

Note that I know that some files can be removed (svhost etc.). However this won't help because I'll still have more than one file. Also I've tried some free assemblers online but none of them worked.

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
N Bousaba
  • 11
  • 2

4 Answers4

0

In Solution Explorer, select the reference of Interop.IWshRunctime... and in the property window, change the value of Embed Interop Types to True.

This will not generate a separate dll for Interop Types.

PS: This is not a generic solution, but works with Interop Type only.

Sarvesh Mishra
  • 2,014
  • 15
  • 30
0

I've used https://github.com/Fody/Costura in the past. Nuget install Install-Package Costura.Fody (https://www.nuget.org/packages/Costura.Fody/)

Description about what it does from the source:

Take all assemblies (and pdbs) that have been marked as "Copy Local" and embed them as resources in the target assembly.

webnoob
  • 15,747
  • 13
  • 83
  • 165
0

Actually you are looking for a method to merge some assemblies and resources into one executable file.
Custora.Fody, ILMerge, Obfuscators with assembly merging feature are some examples that can be used for this purpose.

You can find some answers here:
Embedding DLLs in a compiled executable
How to merge multiple assemblies into one?
List of obfuscators for .NET

Community
  • 1
  • 1
Milad H.
  • 122
  • 6
0

If this is not about security reason, I would create the directory structure as follow:

- root
└ Startup.bat
└ lib
    └ DiagnosticsSwitch.exe
    └ DiagnosticsSwitch.exe.config
    └ DiagnosticsSwitch.exe.manifest
    └ Interop.IWshRuntimeLibrary.dll

And inside the Startup.bat

"lib/DiagnosticsSwitch.exe"
Zay Lau
  • 1,856
  • 1
  • 10
  • 17