sweet suman
sweet suman

Reputation: 1082

Compile project with multiple DLL file to single EXE without Visual Studio IDE

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.

Upvotes: 1

Views: 902

Answers (1)

Access Denied
Access Denied

Reputation: 9501

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.

Upvotes: 1

Related Questions