1

我一直在试图打开Visual Studio 2010中一个Silverlight 3的解决方案,但我已经得到了以下错误:无法加载Silverlight 3的项目在Visual Studio 2010

Unable to read the project file 'ESM.Visualization.csproj'. C:\Code\ESM\ESM.Visualization\ESM.Visualization.csproj(238,3): The imported project "C:\Program Files(x86)\MSBuild\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on the disk.

我发现我没有Silverlight v3.0,但我找不到在我的Visual Studio 2010上获得Silverlight 3.0的方法,特别是因为我已经安装了Silverlight v4.0。

+0

另外[解决-微软Silverlight的CSHARP靶点-被未找到(http://stackoverflow.com/questions/3591369/silverlight-4- resolving-microsoft-silverlight-csharp-targets-was-not-found)是一个有用的链接。 – Shubh

回答

3

您必须手动更改* .csproj文件。

打开它在任何文本编辑器,定位到与不正确的代码(编号238,我想)线,并检查它看起来如此:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" /> 

然后改变这些行,设置的内容第二元件为 “4.0版”:

<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> 
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> 
+0

这会对项目有任何不利影响吗?我正在考虑这样做,但我不想意外打破所有的事情。 –

+0

@Yawus,如果使用visual studio编辑器编辑项目设置(从组合框中选择另一个版本的Sivlerlight),它的工作方式也是一样的。没有魔法:默认编辑器只是改变* .csproj文件,仅此而已。所以你可以手动做同样的事情。 – vorrtex

相关问题