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

相關問題