开发者

.net: Module System.Core version 3.5.0.0 should be referenced

I have a couple of probably related issues.

Firstly in my ASP.NET MVC project view, lambda expression syntax like this:

<% =Html.TextBoxFor(x => x.Umi)%>

results in ReSharper highlighting the line and displaying the message :

Module 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' should be referenced

Secondly, using the Where extension method on an IEnumerable<T> in the same view causes a compilation error because the extension method cannot be found开发者_StackOverflow.

Adding a reference in the project to System.Core results in this:

A reference to System.Core could not be added. This component is automatically referenced by the build system.

I assume this stuff is related to the fact that the project was created as a .NET 4 project but I had to change it to target 3.5 instead as the server doesn't have 4 installed.

Anyone help?


Although I still have no idea what caused the problem, I was able to fix it by modifying the project's .csproj file to manually add the reference.

  1. Right click on the project name and click 'Unload Project'
  2. Right click on the project name and click 'Edit [Project Name].csproj'
  3. Add the following Reference node to the ItemGroup node (see code below) and save
  4. Right click on the project name and click 'Reload Project'

The code to add a reference to System.Core directly into the .csproj file is below:

<Reference Include="System.Core">
  <Private>True</Private>
</Reference>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜