Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add an assembly to a Visual Studio project and reference it?

I've compiled an assembly for MySql.Data.dll and would like to add it to a new Visual Studio Project. I'm lost on the correct terminology and how best to go about this, but the end goal is to distribute this dll so that it's included with the application when the application runs. This is to avoid having to GAC the dll on the end user's machine.

I've tried simply copying the assembly into the project folder:

However, I can't figure out how to add a reference to that dll in the current project. Nor have I figured out how to ensure that this dll will "stay with" the application once it is compiled. How might this be accomplished and what other things might I consider?

like image 575
Ben McCormack Avatar asked Jan 28 '10 19:01

Ben McCormack


2 Answers

Try the following

  • Right cilck on the References Node
  • Choose "Add Reference"
  • Click on the Browse tab
  • Navigate to the dll MySql.Data.dll on disk and hit OK

Once it's added, click on the reference under the References folder and hit F4. This will bring up the properties tool window. Make sure it is set to "Copy Local" = True. This will ensure it gets deployed with your application by the standard installers (MSI and ClickOnce)

like image 146
JaredPar Avatar answered Sep 19 '22 01:09

JaredPar


Right-click on References and select Add Reference..., navigate to the to DLL and presto ... you're done.

like image 32
Keith Adler Avatar answered Sep 22 '22 01:09

Keith Adler