KingNestor
KingNestor

Reputation: 67960

When I make a project reference in Visual Studio, do I then have to include the DLLs for those projects when I deploy?

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

Answers (5)

Alex
Alex

Reputation: 13229

Be careful with ILMerge and make sure you understand the performance implications of going this route.

Upvotes: 0

nos
nos

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

Joel Etherton
Joel Etherton

Reputation: 37533

You should be able to accomplish by selecting your references and setting the "Copy Local" property to false.

Upvotes: 0

JP Alioto
JP Alioto

Reputation: 45117

Check out ILMerge.

Upvotes: 2

Andrew Hare
Andrew Hare

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

Related Questions