简体   繁体   English

添加对C#项目的引用将立即无效

[英]Adding a reference to C# project it's immediately invalid

I'm trying to add a reference to a C# class library project. 我正在尝试添加对C#类库项目的引用。 It's immediately shown as invalid in Solution Explorer. 立即在解决方案资源管理器中显示为无效。 The project is targeting .NET framework 4.5. 该项目的目标是.NET Framework 4.5。

In order to add the reference, I'm right clicking on References -> Add Reference -> Then picking Microsoft.CSharp Version 4.0.0.0 from the Framework Assemblies. 为了添加引用,我右键单击“引用”->“添加引用”->,然后从框架组合中选择Microsoft.CSharp版本4.0.0.0。

After I've added the reference if I look at the properties on the Microsoft.CSharp Assembly that I've added it shows as Version 0.0.0.0 Any idea what's wrong? 如果我查看添加的Microsoft.CSharp程序集上的属性,则添加引用后,将显示为0.0.0.0版。知道什么地方出错了吗?

I'm using Visual Studio Ultimate 2013. 我正在使用Visual Studio Ultimate 2013。

Here's what the references look like in the csproj file: 这是csproj文件中的引用内容:

<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />

I'm not sure if this will be helpful to anyone else in the future, but I fixed these issues by fixing some other reference issues. 我不确定这对将来是否对其他人有帮助,但是我通过修复一些其他参考问题来解决了这些问题。

I had created this C# class library project using some proprietary scaffolding written by the company that I work for. 我使用我工作的公司编写的一些专有脚手架创建了这个C#类库项目。 The scaffolding is somewhat out of date and created some reference problems with some company-supplied references as well. 脚手架有些过时了,并且也为一些公司提供的参考文献造成了一些参考问题。 At any rate, fixing these other references seem to fix the System.xml, Microsoft.Csharp, etc. ones as well. 无论如何,修复这些其他引用似乎也可以修复System.xml,Microsoft.Csharp等。

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

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