2013-01-02 23 views
1

我有一個Windows Phone 8 C#項目和Windows Phone 8 C++庫的Visual Studio 2012解決方案。我把它移到了另一臺電腦上。現在,當我嘗試打開該解決方案,庫項目失敗,並在控制檯下面的消息加載:每個項目在哪裏TargetPlatformVersion?

MyLib.vcxproj : error : Unable to read the project file "MyLib.vcxproj". 
MyLib.vcxproj(620,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsPhone\v7.0\Microsoft.Cpp.WindowsPhone.7.0.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. 

當我看着到項目文件中,我發現上線以下620:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" /> 

所以它看起來像環境變量TargetPlatformVersion的價值有點關閉。

然後我在這臺機器上創建了另一個解決方案,也是C#/ C++組合。那個打開並編譯和運行,nae問題。查看新創建的庫中的項目文件,它在末尾具有相同的<Import>行。

現在,解決方案複製可能並不完美。我沒有複製所有文件 - 我認爲是相關的 - .sln,.vcxproj,但不是.sdf而不是.suo。

它看起來像缺少某些東西 - 在解決方案或項目級別上定義值TargetPlatformVersion的文件未被複制,現在Visual Studio正在挑選錯誤的默認值。不用說,WP7.0與它無關,都是WP8。

任何想法在哪裏可以設置此設置?在項目和解決方案中都沒有提及TargetPlatformVersion。

+0

' WindowsPhone71'是否設置正確? – Hades32

+0

這是一個本地項目 - 沒有目標框架。我能找到的最接近的是 v110_wp80。 –

回答

0

經過幾次重新開放和其他無意義的行爲後,它自行消失。 Ooky,幽靈般的東西。不知道爲什麼。 SVN不檢測對項目文件的任何更改。

0

我也有這個問題,解決方案是在計算機(顯然它有一個以前的版本,或根本沒有安裝)在Windows電腦(此時SDK SDK V8.0)安裝最新的SDK(SDK V8.0)。

0
 
Step1: Replace every occurrence of $(MSBuildExtensionsPath) to 8.0 in your .vcxproj file 
Step2: Restart Visual Studio 

->Then You will get the error "The builds tools for v120 (Platform Toolset = 'v120') cannot be found" 

To fix this: 
if you are using visual 2012 right click on project name -> properties -> configuration properties -> general -> platform toolset -> Visual Studio 2012 (v110) or wp-v110 

And You will be good to go! 

Note: You can then revert the changes from 8.0 to $(MSBuildExtensionsPath) in your project file if you want. (The cause of the error is when you open a vs2012 project or its dependencies in vs2013)