简体   繁体   English

Visual Studio 2015 - 添加对类库C#ASP.NET的引用

[英]Visual Studio 2015 - Adding Reference to class library C# ASP.NET

I am trying to add references to class libraries under my Web Forms solution. 我试图在我的Web窗体解决方案下添加对类库的引用。 I added several class libraries to the main solution (via File -> New Project -> Add to solution). 我在主解决方案中添加了几个类库(通过文件 - >新建项目 - >添加到解决方案)。 When I tried to add references to them (both from the solution explorer window and the File menu), I received a popup stating simply: "Cannot add reference to ," with no additional error messages. 当我尝试添加对它们的引用时(都来自解决方案资源管理器窗口和文件菜单),我收到一个简单的弹出窗口:“无法添加引用”,没有其他错误消息。

I verified that all projects are using the same version of the .NET Framework (4.5, NOT the client version) and the same target architecture (x64), as I have seen in other Stack Overflow posts. 我验证了所有项目都使用相同版本的.NET Framework(4.5,而不是客户端版本)和相同的目标架构(x64),正如我在其他Stack Overflow帖子中看到的那样。

I did try and add the reference via browse, and added the DLLs from the /bin/debug folder, and that actually worked. 我确实尝试通过浏览添加引用,并从/ bin / debug文件夹中添加了DLL,这实际上是有效的。 The namespaces were picked up and even shown in intellisense. 命名空间被选中,甚至在智能感知中显示。 My concern here is breaking these references during release builds and deployments. 我关注的是在发布版本和部署期间打破这些引用。

截图

I found a workaround for this problem. 我找到了解决这个问题的方法。

When you head over to your solution and add a new project, you'll automatically be directed in the Web category. 当您转到解决方案并添加新项目时,您将自动定向到Web类别。 Instead head over to the Windows tab and pick that Class Library instead. 而是转到Windows选项卡,然后选择该类库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM