Quantcast
Channel: Programming Tips – Black Belt Review
Viewing all articles
Browse latest Browse all 16

Visual Studio 2010 – .NET Framework 3.5 Target Error and Fix

$
0
0

Suppose you have an existing ASP.NET 4.0 C# application and for whatever reason you need to re-target it to ASP.NET 3.5 C#, you will likely encounter the following error when you do the Build -> Publish deployment.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\
Microsoft.Common.targets(1360,9):
 warning MSB3267: The primary reference
 "Microsoft.CSharp", which is a framework
 assembly, could not be resolved in the
 currently targeted framework.
 ".NETFramework,Version=v3.5". To resolve
 this problem, either remove the reference
 "Microsoft.CSharp" or retarget your
 application to a framework version which
 contains "Microsoft.CSharp".

Here is how to fix this error.

  1. Go to the folder where your project resides.  (e.g. C:\prj\myapp)
  2. Look for the .csproj file.  (e.g. C:\prj\myapp\myapp\myapp.csproj)
  3. Edit this file in notepad.exe.
  4. Search for “Microsoft.CSharp”.
  5. Comment it out.
<!-- <Reference Include="Microsoft.CSharp" /> -->

Now you should be able to build and publish your project.

Post a comment if you had encountered this problem and this tip resolved it for you.



Viewing all articles
Browse latest Browse all 16

Trending Articles