.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.
- Right click on the project name and click 'Unload Project'
- Right click on the project name and click 'Edit [Project Name].csproj'
- Add the following Reference node to the ItemGroup node (see code below) and save
- 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>
精彩评论