Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a C# application while including third-party DLL files?

To start with, I don't know much of deployment. I hope my question makes sense.

I need to install/deploy a C# application to a number of desktops. It needs a third-party DLL file: A C++ library ("lpsolve55.dll", for those interested, it is a free MIP/LP solver, see lpsolve.sourceforge.net/5.5/). I use it in my code in the following way:

    [DllImport("lpsolve55.dll", SetLastError = true)]
    public static extern bool add_column(int lp, double[] column);

For testing, I have manually copied the .dll file to to project\bin\release, and it works fine.

My question: I will need an installer for the application, which will manage that the .dll will install as well. I am considering ClickOnce deployment since I am using Visual C# 2008 Express Edition, but any not too expensive solution will do.

What would you advice?

like image 286
Willem Avatar asked Jun 02 '10 08:06

Willem


People also ask

What is deployment in C?

Deployment is the mechanism through which applications, modules, updates, and patches are delivered from developers to users. The methods used by developers to build, test and deploy new code will impact how fast a product can respond to changes in customer preferences or requirements and the quality of each change.

How do I publish a website using Visual Studio?

On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.


1 Answers

Just add your DLL to the project within Visual Studio.

  • Right click project in Solution Viewer
  • Select Add - Existing Item
  • Browse to the DLL and click Add or the little arrow next to the Add button and Add as Link
  • Select your DLL in the Solution Viewer
  • Right click it and select Properties
  • Set Build Action to Content
  • Set Copy to Output Directory to Copy if newer

Now your file will automatically be copied into the debug or release folder.

For deploying you can add a setup project to your solution. When you add the output of your first project to the setup project the DLL will automatically be added to the setup.

But a setup project is a completely new area. So start to work with it and ask a new question if you get stuck with it.

like image 186
Oliver Avatar answered Oct 14 '22 14:10

Oliver