Reputation: 67960
I have a console application and two class library projects.
The console application has to project references to the class library projects.
When I build, it generates DLLs for these two projects. Do I have to include these with my console applications exe file? Is there a way I can make it so I don't have to include these 2 dlls?
Ideally, I'd like to have a single exe.
Upvotes: 2
Views: 465
Reputation: 13229
Be careful with ILMerge and make sure you understand the performance implications of going this route.
Upvotes: 0
Reputation: 229108
You can merge the assemblies into one, using ilmerge, otherwise you'll have to deploy the exe file and the dlls. e.g. you can run a command like
ilmerge /target:winexe /out:MyProg.exe Program.exe ClassLib1.dll ClassLib.dll
Visual Studio provides no built-in way to do this, so you'd have to run the above command manually,as a Post Build event, or add it manually to your .csproj file.
Upvotes: 1
Reputation: 37533
You should be able to accomplish by selecting your references and setting the "Copy Local" property to false.
Upvotes: 0
Reputation: 351516
You must include any referenced assemblies as they are dependencies of your application.
That being said, however, Microsoft offers a tool called ILMerge that will allow you combine the dependency assemblies with your executable to create one, all-inclusive, executable assembly that you can ship to customers.
Upvotes: 5