Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to manage DLLs that you don't reference in Visual Studio

I am working on a C# .NET project in Visual Studio 2010. I am integrating a hardware peripheral that has a DLL. I reference the DLL file in my project and the code compiles/builds without any errors. When I run my application I get a runtime error saying that it is looking for another DLL file. It appears that the DLL I reference in my project has 42 other DLLs that it depends on. When I place these 42 DLLs in the output directory (bin/debug) the application runs just fine.

My questions is this: what is the best way to manage these extra DLL files when Visual Studio doesn't recognize them as dependent libraries?

like image 366
user2022535 Avatar asked Jan 29 '13 17:01

user2022535


1 Answers

This scenario does resemble a lot to deploying SQL Server Compact files. In that context it's called Private File–Based Deployment.
It also requires some external (unmanaged) DLLs that the application will depend on.

What it boils down to is to include the DLLs in your project and set their Copy to Output Directory properties to Copy if newer. They will then be copied to the destination folder after a successful build.

EDIT:
Based on your comment, it seems to you are having problems at install time of you application (something you completely fail to mention in your question), and you have written a Custom Action for your installer to copy these 42 DLLs to your target.
There's no need for a CA to do that. Simply right click on your installer project -> View ->File System. Select the Application Folder, in the right hand side right click and select Add File and add your 42 DLLs.

like image 164
Magnus Johansson Avatar answered Oct 09 '22 21:10

Magnus Johansson