1

When compiling my project, I create a DLL file for each namespace and include them to the EXE I am about to build. My problem is this action creates multiple file, and the output doesn't seem to be portable.

Is it possible (and how) to include all DLL files into a single EXE file?

This is the build script I currently use to build the project:

#!/bin/sh

if [ -d out ]; then
    rm -rf out/
fi;
mkdir out/

csc /nologo /target:library /out:out/StateMachine.Models.dll \
    StateMachine/Models/*.cs &&

csc /nologo /target:library /out:out/StateMachine.Builders.dll \
    /reference:out/StateMachine.Models.dll \
    StateMachine/Builders/*.cs &&

csc /nologo /target:exe /out:out/state-machine.exe \
    /reference:out/StateMachine.Models.dll \
    /reference:out/StateMachine.Builders.dll \
    StateMachine/Application.cs

I am using this script since my machine cannot install/run MSVS IDE.

sweet suman
  • 1,031
  • 8
  • 18

1 Answers1

1

Compile your exe with csc and then ILMerge libraries:

ilmerge /target:winexe /out:SelfContainedProgram.exe Program.exe ClassLibrary1.dll classLibrary2.dll

There are alternatives for Mono.

Note: libraries should not be signed.

Access Denied
  • 8,723
  • 4
  • 42
  • 72