4

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.

Community
  • 1
  • 1
cranesbane
  • 181
  • 1
  • 1
  • 8
  • You say that reinstalling resolved the issue. Do you still have a machine in the broken state, or can you repro the broken state? – James McNellis Jul 21 '12 at 20:26
  • The person linked above stated re-installing fixed things. I am only now trying that since I can't think of anything else. Will edit in the result. I don't know how to reproduce it since I can't say for certain when this was triggered. – cranesbane Jul 21 '12 at 21:24
  • We've seen the "no syntax highlighting" issue before but have not been able to repro it. If you're willing to help us debug the issue, would you drop me an e-mail at james@jamesmcnellis.com? I'd like to get some information about your configuration to see if we can figure out why this happens. Thanks! – James McNellis Jul 21 '12 at 23:51
  • /resetuserdata fixed it for me. I don't know how I can help since I can't even say when this started. My config was only office tools installed extra, F# profile default, and registry tweak to change all caps issue. One strange thing is after fix, it's now using vs 2012 instead of VS11 for project folders. Perhaps a latent bug in settings carried over from beta. Still doesn't answer why so long to show up though. – cranesbane Jul 22 '12 at 00:21

6 Answers6

7

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.

Adi Lester
  • 24,731
  • 12
  • 95
  • 110
cranesbane
  • 181
  • 1
  • 1
  • 8
  • 1
    where is devenv in vs2012? – KJW Feb 21 '13 at 05:50
  • you can find it in your start menu => visual studio 2012 => visual studio tools => developer command prompt. But unfortunately this does not work for me. Just running it works fine. – user1841243 Sep 28 '13 at 12:14
  • I have VS 2013 Ultimate and had this crop up this week. I tried the command above without reinstalling and the problem persists. So looks like I need to uninstall/reinstall. – dex3703 Jan 03 '14 at 17:49
  • For VS 2013 Express users, this is actually a call to `WDExpress /ResetSettings`. `WDExpress.exe` is located in `Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE` on my install. Note also, this did *not* fix the problem for me, neither did running a "repair" install; I had to uninstall completely, reinstall, and *reopen* any files that were left open from the previous run of the IDE. – cod3monk3y Sep 10 '14 at 21:57
  • Thank you. After almost 10 years from this answer, this solution worked for my Visual Studio 2022. – Soli Dec 14 '22 at 15:04
3

Check the following:

  1. Tools -> Options
  2. Expand Text Editor -> XAML -> Miscellaneous
  3. Make sure that "Always open documents in full XAML view" is not checked

Or perhaps the default program for opening .xaml files has changed:

  1. Right-click your .xaml file in Solution Explorer
  2. Click Open With...
  3. Select XAML UI Designer
  4. Click Set as Default button
  5. Click OK

EDIT

This does appear to be a known bug with an earlier version of VS11.

Kevin Aenmey
  • 13,259
  • 5
  • 46
  • 45
  • 1
    Unfortunately when I go to Tools -> Options -> Text Editor there is no XAML option. Only XOML which I did not know was a thing till today. – cranesbane Jul 21 '12 at 21:18
  • What build version of VS are you using (`HELP` -> `About Microsoft Visual Studio`)? – Kevin Aenmey Jul 21 '12 at 21:34
  • This is the same version I am using. I'm not sure if it helps, but I do have the `XAML` option under `Text Editor` options. – Kevin Aenmey Jul 21 '12 at 22:53
  • Ok. With the july update I have 11.0.50706.0 QRELRC so my version is very unlikely to be an old one. The bug you link to is an intellisense bug, mine was XAML simply packing up and leaving VS! Reinstalling helped. But now no highlighting... Anyways if no one comes along with a helpful answer I will mark this as correct since it indicates what a poor mess WPF is in VS11 – cranesbane Jul 21 '12 at 22:57
  • The tip to rt-click on a xaml file and choose Open With worked for me - I chose the workflow editor and finally got my workflow to open. – Rusty Divine Jul 22 '14 at 19:04
  • Just had this crop up in VS 2013 (Version 12.0.30723 Update 3). No XAML option under `Tools` > `Options` > `Text Editor`. No `XAML UI Designer` option in `Open With...` either. Sounds like the exact problem the OP had. XAML support has just *disappeared*. – cod3monk3y Sep 10 '14 at 18:29
0

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

0

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.

enter image description here

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
user2202911
  • 2,898
  • 5
  • 20
  • 28
0

I had the same issue in Vs 2012 express edition. Solved by running vs2012 command prompt and executing the code

WDExpress/ResetSettings

Adeeb Arangodan
  • 152
  • 1
  • 11
0

I downloaded my working last repo from github, and then I opened it to check it worked, which it did. I replaced the xaml, and cs files and it still didn't work. So I just copied all the files in the root,

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

Everything loaded again, thank goodness.

Spinstaz
  • 287
  • 6
  • 12