问题
Design View for Xaml on Visual Studio Professional RC 2012 used to work for me. But suddenly stopped for no reason I can figure.
- Visual Studio 11 No longer Recognizes Xaml Files.
- In properties, it treats XAML files like XML.
- In solution Explorer it recognizes it as a xaml file
- Right Click -> Design View opens a new Xaml code page
- Controls Toolbox shows nothing
- My OS is Windows 7 x64.
- I have applied all updates up to July 2012 to VS11
- I have tried Repairing Visual Studio & Resetting Settings but to no avail.
- There is nothing in search or stackoverflow I could find to remedy this.
- I have not tried un/reinstalling
Visual Studio 2012 RC designer does not recognize xaml for a Windows Metro app looks identical to my case but my problem suggests the issue is more general than his title.
Reinstalling fixed his issue but does not shed light on this frustrating problem.
Can someone help?
EDIT - Reinstalling nearly resolved the issue. Design view works, toolbox is populated, auto complete is back, XAML is available under tool-> options->text... and control element properties can be viewed.
Everything is normal except for the passing strange fact that XAML Code View no longer does syntax highlighting. This is not suprising since unlike what http://msdn.microsoft.com/en-us/library/bb907395(v=vs.90).aspx expects, there are no XAML prefixed items in the displayed items.
Perhaps relatively minor in the scheme of things but also a very annoying loss.
回答1:
Suggestion 4 in this link worked for me:
devenv /resetuserdata
in Command Prompt.
So at least in my case, re-installing and then the above command cleared all issues. It is possible that resetting user data could have made it unnecessary to re-install but I can't know that now.
I still can't say what caused this but it seems a pretty long tail issue that occurs sporadically and looks to have precursors in older versions.
回答2:
Check the following:
Tools
->Options
- Expand
Text Editor
->XAML
->Miscellaneous
- Make sure that "Always open documents in full XAML view" is not checked
Or perhaps the default program for opening .xaml
files has changed:
- Right-click your
.xaml
file in Solution Explorer - Click
Open With...
- Select
XAML UI Designer
- Click
Set as Default
button - Click
OK
EDIT
This does appear to be a known bug with an earlier version of VS11.
回答3:
If anybody is interested. I had the failure: Could not open XAML and config files in Visual Studio 2012. Now I detected the cause: the Solutions suo files were corrupted after a System Crash. So I (was not sure) rebuilt the sln file in a different Folder and copied the sln and suo files (they are hidden!) to the old Folder. That definitely brought me back the lost functionality. Maybe it is only necessary to delete the old suo files. Juergen
回答4:
In Visual Studio 2013 I had a similar issue - I change my build action & from 'BundleResource' to 'AndroidResource' and I was able to get it working
回答5:
I had the same issue in Vs 2012 express edition. Solved by running vs2012 command prompt and executing the code
WDExpress/ResetSettings
来源:https://stackoverflow.com/questions/11595434/visual-studio-2012-not-recognizing-xaml-files-design-view-broken