I have a Visual Studio 2012 solution with a Windows Phone 8 C# project and a Windows Phone 8 C++ library. I've moved it to a different computer. Now, when I try to open the solution, the library project fails to load with the following message in the console:
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.
When I look into the project file, I find the following on line 620:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
So it looks like the value of environment variable TargetPlatformVersion
is somehow off.
Then I've created another solution on this machine, also C#/C++ combo. That one opens and compiles and runs, nae problemo. Looking at the project file in the newly created library, it has an identical <Import>
line near the end.
Now, the solution copying might have been not perfect. I did not copy all files - just what I thought were the relevant ones - the .sln, the .vcxproj., but not the .sdf and not the .suo.
It looks like something was missing - a file that defined the value of TargetPlatformVersion
on solution or project level was not copied, and now Visual Studio is picking a wrong default. Needless to say, WP7.0 has nothing to do with it, it's all WP8.
Any idea where could this setting reside? There's no mention of TargetPlatformVersion in neither project nor solution.
It went away on its own after a few reopens and other meaningless actions. Ooky, spooky stuff. No idea why. SVN does not detect any changes to project files.