Adding Referenced DLL to a C#Executable

Asked

Viewed 952 times

4

I developed a console application in C# that makes use of a referenced dll. After batch build and generating the application executable, I tried to run it on a computer that did not have this dll, of course an error occurred. Soon after I passed the dll to the computer and left in the same folder of . exe and the same occurred.

I know I need to somehow link this dll at build time, or something like that, but I don’t know how. I wonder how to generate this executable so that it works on another computer?

  • 3

    Try via Project > Add reference... and then make sure that the DLL is in the folder bin\debug (or release, depending on the context used) of your application

1 answer

3

Before giving the batch of the application, go to its reference and do the following:

Right click on it and go into properties, after that change the Copy Local for TRUE

Make your batch and you will see that now dll is duplicated in your application, send this way to the other computer and ready.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.