Referencing a dll in C#

2019-05-13 21:41发布

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.

标签: c# dll
2条回答
一夜七次
2楼-- · 2019-05-13 22:34

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.

查看更多
迷人小祖宗
3楼-- · 2019-05-13 22:34

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.

查看更多
登录 后发表回答