Ryan
Ryan

Reputation: 1141

Referencing a dll in C#

When I reference a dll in c#, it has my local path. So when I run it on another computer it can't find it. How can I add a dll so it isn't looking in my local folder?

When I run my program on another computer it says "can't find namespace, are you missing a using directive or assembly reference?"

I must be googling the wrong key words because I couldn't find it anywhere.

Upvotes: 3

Views: 12519

Answers (2)

Uri London
Uri London

Reputation: 10797

Assembly reference don't have the path (local or whatever). Just the referenced assembly names. You can verify it yourself with ildasm, and double click on the assembly manifest.

The referred assembly has to be accessible on the other machine. Either on the same directory, or in the search path, or in the GAC. It is your deployment program (script, setup, or otherwise) that has to make sure you deploy all the dependency on the client machine.

Upvotes: 1

mellodev
mellodev

Reputation: 1607

Right click on it in the References area, go to properties, and set "Copy Local" to True. This will copy the dll into your output/bin folder for distribution and should solve the dependency on a machine without the DLL.

Upvotes: 10

Related Questions