2

I have this code in constructor:

            InitializeComponent();

            textBox3_text_valid = 0;
            label8.Visible = false;
            label8.Visible = false;
            Logger.exist();

I added to my project a reference dll OpenHardwareMonitor.dll The problem is that the dll is in my debug directory. But when i Rebuild Solution and Save All

And then send the project exe file only to my brother or running this program in my pc after i deleted the debug directory im getting error that the OpenHardwareMonitor.dll is missing.

In the properties in my project under reference on openhardwaremonitor.dll i see:

Aliases : Global

Copy Local : True

Ember Interop : False

How can i add the dll to the project to the exe file or something so i wont need to send it to my brother the dll ? And if i must send my brother the dll file where should he put it ? He dosent have the Debug directory.

user3117033
  • 185
  • 1
  • 4
  • 13

2 Answers2

6

The problem is that the dll is in my debug directory.

Don't do that then. I would suggest you create a lib directory or something like that, and add a reference to the library from there. By default, that will copy it when you build (i.e. Copy Local will be true).

In general, you should never be manually copying things into your output directories - you should assume they can be wiped at any time by the build process. Instead, put things into directories which you "own" and let the build process copy them.

Also, where possible you could use nuget for third party libraries - that makes managing them somewhat simpler.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
5

you should create a folder in your solution or your project , then copy your dll into this folder. right click on your project and select properties, go to the reference paths tab, select path of this folder and then click add folder button.

Katy
  • 286
  • 2
  • 18