Visual Studio 2012无法识别Xaml文件,设计视图已损坏

d4so4syb  于 2022-12-07  发布在  其他
关注(0)|答案(6)|浏览(235)

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.

mepcadol

mepcadol1#

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.

sbtkgmzw

sbtkgmzw2#

请检查以下各项:

  1. Tools -〉Options
    1.展开Text Editor-〉XAML-〉Miscellaneous
    1.确保未选中“始终在完整XAML视图中打开文档
    或者,打开.xaml文件的默认程序可能已更改:
    1.在解决方案资源管理器中右键单击.xaml文件
    1.单击Open With...
    1.选择XAML UI Designer
    1.点击Set as Default按钮
    1.单击OK

编辑

这看起来确实是带有VS 11早期版本的known bug

kjthegm6

kjthegm63#

如果有人感兴趣的话.我有过这样的失败:无法在Visual Studio 2012中打开XAML和配置文件。现在我检测到了原因:解决方案suo文件在系统崩溃后损坏。所以我(不确定)在不同的文件夹中重建了sln文件,并将sln和suo文件(它们是隐藏的!)复制到了旧文件夹。这无疑使我恢复了丢失的功能。也许只需要删除旧的suo文件。Juergen

zpjtge22

zpjtge224#

我在Vs 2012 Express Edition中遇到了同样的问题。通过运行vs 2012命令提示符并执行代码解决了
WD快速/重置设置

6ljaweal

6ljaweal5#

在Visual Studio 2013中,我遇到了类似的问题--我将构建操作从BundleResource更改为AndroidResource,并且我能够让它工作。

enyaitl3

enyaitl36#

我从github下载了我最后一个可用的repo,然后我打开它检查它是否工作,它确实工作了。我替换了xaml和cs文件,它仍然不工作。所以我只是复制了根目录下的所有文件,

App.config
App.xaml
App.xaml.cs
MainWindow.Xaml
MainWindow.xaml.cs
packages.config
.csproj
.sln

一切都重新加载,谢天谢地。

相关问题