Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper build action when adding a non-reference dll to a .NET project in Visual Studio

Lets say I want to include a DLL in a Visual Studio project that is not going to be a reference. In my case it will be a custom trace listener, but it might also be a DLL that I am loading via runtime binding. I don't want to add it as a reference because I don't want to introduce the possibility of any of my code statically referencing it by accident.

So if I add the dll to the project should I set the build action to "None" or "Component." I set the "Copy To Output Directory" property to "Copy Always"

like image 276
Justin Dearing Avatar asked Oct 23 '25 06:10

Justin Dearing


1 Answers

"Content" may be more appropriate, since I believe that includes it by default when you publish the project, be it via msi (installer) or ClickOnce.

like image 190
Marc Gravell Avatar answered Oct 26 '25 04:10

Marc Gravell