找不到导入的项目" C:\ Microsoft.CSharp.targets"

时间:2020-03-05 18:38:33  来源:igfitidea点击:

我今天在尝试在Visual Studio 2005中打开Visual Studio 2008项目时收到此错误:

The imported project "C:\Microsoft.CSharp.targets" was not found.

解决方案

回答

在记事本(或者记事本++)中打开csproj文件
找到这行:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

并将其更改为

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

回答

MSDN上的此链接还可以理解其不起作用的原因。 $(MSBuildToolsPath)是Microsoft.Build.Engine v3.5的路径(在VS2008中创建时自动插入到项目文件中)。如果尝试为.Net 2.0构建项目,请确保将此路径更改为$(MSBuildBinPath),这是Microsoft.Build.Engine v2.0的路径。

回答

ok so what if it say this: between the
  gt/lt signs
  
  Import
  Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets"
  /
  
  how do i fix the targets error?

我还在演示项目中找到了导入字符串(特别是Rob Eisenburg的" Build your own MVVM Framework")。

如果用lomaxx建议的导入替换该导入,则VS2010 RTM报告需要安装此导入。