【发布时间】:2021-07-02 14:39:02
【问题描述】:
我使用 Visual Studio 创建了一次 Tester.dll 文件,现在我想将其用于新的 Visual Studio 项目。在解决方案资源管理器中,我单击了项目并添加了dll,然后我可以在程序集下看到它。然后在Program.cs 文件中我写了using Tester;。
如果我构建它,我会收到错误消息The type or namespace Tester could not be found (are you missing a using directive or an assembly reference)
还有没有我错过的步骤?
我的项目结构如下:
Server
│ └── Communication.sln
|── Lib
│ ├── Tester.dll
├── CommunicationServer
│ ├── bin
│ ├── obj
│ ├── CommunicationServer.csproj
│ └── Program.cs
│ ├── Tester.dll
├── Communication
│ ├── bin
│ ├── obj
│ ├── Communication.csproj
很遗憾,我既不了解 Visual Studio,也不了解 C#。
【问题讨论】:
-
您需要在 CommunicationServer 中添加对 Tester.dll 的引用(在 Dependencies 下) - 您不应该直接将 dll 添加到项目中。
-
如果我引用
Tester.dll(在它真正产生的文件夹中)它仍然找不到它。
标签: c# visual-studio dll