问题
- Installed Windows 8 Consumer Preview
- Installed Visual Studio 2010 Premium
- Installed Visual Studio 11 Ultimate
Everything installed without any errors.
I created a new Windows 8 Metro app using Visual Studio 11 and have no issues viewing xaml in VS 11 designer. If I view it in Blend For Visual Studio 11 a propup with error:
The project 'TestApp.csproj' could not be opened. The imported project 'C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11\Microsoft.Windows.UI.Xaml.CSharp.Targets' was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. c:\Users\testuser\Documents\Visual Studio 11\Projects\TestApp\testApp.csproj
Also if I create a Windows Metro style project(any of the templates) in Blend For Visual Studio 11 it shows an empty solution after it's done. When I look at the directory of where it suppose to create it I only see the project files but no solution.
Has anyone else had these issues?
Now the only question is how
--Comment 1--
No, path C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml**v11**\Microsoft.Windows.UI.Xaml.CSharp.Targets doesn't exist. The path on the file system is C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml**v11.0**\Microsoft.Windows.UI.Xaml.CSharp.Targets
When I look at the project file this is what I see:
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
The project file seems to be telling it the correct location so I'm not sure why it's trying to look in the wrong path?
--End Of Comment 1--
回答1:
Try this workaround from the known issues list:
1.3.3.35 Blend cannot create projects for Metro style apps built using HTML when Visual Studio 2010 is installed after Visual Studio 11 Beta When Visual Studio 2010 is installed after Visual Studio 11 Beta, the installation changes an environment variable to a variable that is incompatible with Blend.
(emphasis added)
To resolve this issue:
To work around this issue, do the following:
- Right-click Computer, and then click Properties.
- Click Advanced Properties.
- In the System Properties dialog box, on the Advanced tab, click Environment Variables.
- Under System Variables, click New.
- Under Variable name, type: VisualStudioVersion.
- Under Value, type: 11.0.
- Click OK.
For Windows 8, to get to the environmental variables:
- Do a search for Advanced System Settings
- Make sure you have Settings selected on the right hand side
- Select the View advanced system settings option
来源:https://stackoverflow.com/questions/9760643/blend-for-visual-studio-11-get-an-error