[Windows 8] CSharp targets not found in Blend 5 after Windows Phone SDK

I had a little accident last week and needed a computer fast. The only thing I could get was a computer with Windows 8 Consumer Preview already installed. That was actually no problem as I’m currently working on a Windows 8 project. Problem is that I also work on a number of Windows Phone projects.

Apart from the XNA installation problem, the WP SDK was no problem to install and all seemed fine, until I opened up the Windows 8 project in Blend… or actually tried to open it up.

Whatever I did I was greeted with the same message:

Message

I tried a number of (time consuming) things here, repair of VS11, uninstall of Blend 5 beta and reinstall and in the end a complete reinstall (as in uninstall/install) of Visual Studio 11. No luck.

The I actually started to read the error message:

… The imported project "C:Program Files (x86)MSBuildMicrosoftWindowsXamlv10.0Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <import> declaration is correct, and that the file exists on disk. …

First thought was to check the project file but why would I need to change that, it worked before. Nope, the problem is obviously that the MSBuild targets are not found where it’s supposed to be.  Second try was to copy the actual files to the v10.0 path. That didn’t do it either, led to a couple of new problems instead.

Finally I found the problem after some experimenting (remember, this is Windows 8, searching the net will get you about 3 hits – none of them relevant). The solution was to add an Environment variable to the system to get it running.

  1. Right click on Computer, select Properties
  2. Select Advanced system settings
  3. Down to the right you find Environment variables (they get a bit harder to find for each version of Windows…)
  4. Add the System variable VisualStudioVersion with a value of 11.0 and that’s it

Env

Now open up Blend 5 and load your Windows 8 project!

5 Comments

  1. Eljay

    Or from a CMD.exe shell…
    setx VisualStudioVersion 11.0

  2. Thanks! I had just given up and assumed that it wouldn’t work. Still can’t get Blend 4 for the Phone working…

  3. Thanks you.

    That helps me a lot… :)

  4. Worked like a charm! thanks!

Leave a Reply