简体   繁体   English

无法引用新的C#类库项目

[英]Unable to reference new C# class library project

Background 背景

I am working on a reasonably large legacy ASP.NET MVC solution. 我正在研究一个相当大的遗留ASP.NET MVC解决方案。

Currently all of the code resides in just two projects (one containing model first C# generated code, the other containing the rest of the application). 当前,所有代码仅驻留在两个项目中(一个包含模型第一个C#生成的代码,另一个包含应用程序的其余部分)。

Problem 问题

I've added 2 projects to the solution - one for unit tests & one containing some code to be used as a service by the web application. 我已经在解决方案中添加了2个项目-一个用于单元测试,另一个包含要由Web应用程序用作服务的代码。

When I reference the service project from the main project there's a yellow warning sign by the reference. 当我从主项目引用服务项目时,引用旁边会显示一个黄色警告标志。

As I said this is a legacy project with code all over the place & I'm not sure why this is happening. 正如我说的那样,这是一个遍历整个代码的遗留项目,我不确定为什么会这样。

I've tried Googling for a solution but haven't been able to find anything that gives some clues to this problem... 我尝试使用谷歌搜索解决方案,但找不到任何可以为该问题提供线索的东西...

Note: There are just two classes in the service project 注意:服务项目中只有两个类

Here's a picture of the warning: 这是警告的图片:

参考警告

Make sure that both projects are set to the same version of the .NET Framework. 确保两个项目都设置为相同版本的.NET Framework。

在此处输入图片说明

For example if your Main project targets to .NET Framework 4.0 and your Services project targets to .NET Framework 4.5.2, you can expect some compatibility issues. 例如,如果您的Main项目针对.NET Framework 4.0,而Services项目针对.NET Framework 4.5.2,则可能会遇到一些兼容性问题。

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

相关问题 C# - MVC - 参考 class 库项目到主项目的问题 - C# - MVC - Issue with reference a class library project to main project 将C#类库引用添加到VB.Net Project - Add C# class library reference to VB.Net Project 如何在Visual Studio 2010中引用C#类库项目? - How to reference a C# Class Library project in Visual Studio 2010? C#类库引用 - C# class library reference 在C#项目中参考C ++ / CLI类库(编译的dll) - Reference C++/CLI class library (compiled dll) in C# project C# - 类库项目 - 构建项目时无法更新 App.config 文件 - C# - Class Library Project - Unable to update App.config file while building the project Visual Studio C# 我可以使用哪个 Class 库项目引用 Blazor 项目 - Visual Studio C# with which Class Library Projects can I reference a Blazor Project 如何将现有的C#项目导入可移植类库,并使用它引用Visual Studio中的android应用? - How to import your existing C# project into a portable class library and use it to reference to android app in visual studios? 如何从其他解决方案引用ac#类库项目(不是dll) - How to reference a c# class library project(not dll) from a different solution C#/新关键字/类成员参考 - C# / new keyword / class member reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM