VS2013 - Operation Could Not Be Completed - visual-studio

After installing Visual Studio 2013 and playing around with some of the new features, I noticed I'm unable to open a cshtml file in one of my MVC projects. If I try opening it in the default html editor, I'm receiving the following error
The operation could not be completed
Opening the file in another editor, IE: HTML (Webforms) Editor, opens the file without any issue. So it seems to be an issue with the default Html Editor.
I've followed various suggestions for how to combat this problem from previous versions of VS. If I delete all the solution's ".suo" files, and restart Visual Studio, the error changes to:
Object reference not set to an instance of an object
Once Visual Studio creates a new ".suo" file, the error message reverts back to the previous one.
I've tried doing a repair install on VS2013, however I'm still running into the same issues. Also, running VS in Safe-Mode did not work either. I tried creating a new MVC project, which failed during creation. With any of these errors, the windows event log does not contain any messages.
Has anyone else had this problem?

Just found your question here because it happened to me as well. Here's what I did and hopefully it will fix / help find the problem.
Deleted all .suo
Terminate IIS Express
Close VS2013 and re-open
Open your project and try to start it (F5)
You probably have an error on your web.config file. For me it was an <appSettings> being there twice.
Fixed the web.config file, save and boom, error is gone.
Hope it will also fix your situation.

Found a working solution here (tested with VS2015 Update 1):
https://github.com/aspnet/Tooling/issues/276#issuecomment-166650817
Close VS
Delete the content of %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Open VS

I just figured it out. In my web.config, I had the following in my
<appSettings>
<add key="webpages:Version" value="2.0.?.?" />
</appSettings>
Changing this the value to "3.0.0.0" resolved the issue. I never had a problem with this on VS2010 or VS2012. It seems there is something in the IDE that is not handling this gracefully.

That worked for me for VS 2015 (command prompt as Admin):
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
devenv.exe /resetuserdata

Like most people here have mentioned, review your web.config file for duplicates. I was in a rush, just copied and pasted appSettings from another solutions without noticing the section existed already in the existing document. Then issue this thread relates to started to surface. I went back and consolidated the appSettings, saved, and the issue ceased to exist.

For me this error was resolved by setting the VS 2013 shortcut to "run as administrator".

Check for errors in your web.config file:
duplicate keys (app settings)
tags not closed or used multiple times
...

It is due to IIS Express not running from Visual Studio when you try to debug the aspx page.
Quick and dirty fix is to right click the your project and choose "Use Visual Studio Development Server" and then again right click and choose back to "Use IIS Express" will fix this problem. This way I will care about all the changes required in configuration file.

I also got this problem after using some Nuget package. The problem was a duplicate of appSettings. I merged them all and it worked.

There is also this thread that an MS employee has answered with possible cause:
This is a bug in the debugger. There is a race condition that happens when all of the following are true:
Script debugging is enabled in IE User is debugging IE and another process
The other process stops (hits breakpoint, step operation completes, stops at an exception, etc) at a moment when IE is not running script code
IE starts running script code at roughly the same moment that the user hits F10/F5 in Visual Studio.
The most likely
reason for this to happen is that the code from 'setTimeout' is run,
but I am not a JScript expert, so I am sure there are other possible
reasons as well.
and these workarounds:
If you hit this problem, I believe you could detach the debugger and then re-attach.
-or-
This problem happens when debugging ASP.NET and when script debugging is enabled in IE. If you disable script debugging in IE, or
toggle it on and off when switching between debugger server-side and
client-side problems, you would be able to work around the issue.
-or-
If your web application is using setTimeout, you may be able to avoid or at least reduce the problem by doing something to ensure that
script runs less often. This could mean increasing the timeout value,
or this could mean adding conditions around when setTimeout is used.

I had error in my web.config file, there was two spaces before <xml> tag. after removing it stopped showing this error.

I had the same error in VS 2015 running on Win 10. Fortunately fixed simply with a reboot. On restart it appears windows applied some updates in the previous session which broke VS somehow.

I got this error in Visual Studio 2015 but only after I installed ASP.NET 5 RC 1.
Installing Visual Studio 2015 Update 1 fixed the problem for me.

What solved my issue is this :
Type %LOCALAPPDATA% in Windows Explorer and go to Microsoft\XX.0 your version of Visual Studio then delete the folder ComponentModelCache
Restart VS and it worked like a charm!
This is due to an update made to GitHub which is reported in their forum

I was asked by a colleague to look at this problem. I tried all the proposed solutions and nothing worked. Eventually I found that they had done a project Update from svn and they had a conflict and ignored it. In one of the config files I found the conflict marked ".yours". I corrected this and all now loads without error.

In my case, the problem was due to my web.config's app settings include pointing to a file that doesn't exist:
<appSettings configSource="App_Config\MISSPELT-FILENAME.config" />

Related

Visual Studio 13 raises unknown error at the startup?

As I start visual studio 13 it raises unknown error by saying "Microsoft Visual Studio 2014 has stop working" without any further explanation.
Here's what I've tried to solve this problem;
I reinstall .Net framework
I repair, uninstall-install Visual Studio
2013
I installed another version of VS13
but still the problem persists. Do you have any further suggestion ?
I am using Windows 8.
I've run into a similar situation described here. Once i find a solution, i will post it there.
As a first attempt i would try to generate a logfile via the /log option and see if there is a problematic extension that you could disable/deinstall, e.g. NuGet.
You say you reinstalled VS2013, so the problem might be related to settings. If reverting all settings is an option for you, see this thread on how to truly really reset your settings. This involves calling your devenv.exe with special parameters (e.g. in a cmd.exe), removing files and tinkering with the registry.
I have found the solution to this or a similar problem if you are starting Visual Studio by loading a solution file.
The symptoms are that a solution that previously could be loaded with no problems, suddenly starts having the unknown error box appear for every project in the solution. Sometimes you can't see the relationship to the continuous reappearance of the error message and the project loading, because you don't have the solution explorer open, so you aren't even aware there is a correlation.
The solution to this is to use task manager to stop visual studio, confirm with visual studio that you wish to shut it down and then look for the .suo file for the solution you are trying to load. In VS2012 it appears in the same directory as the solution file and has the extension solutionname.v11.suo while in VS2015 it appears in a hidden .vs directory under the location where the solution file is found, in a folder named for the solution.
Delete this file and the problem will go away.
The .suo file contains the user preferences for the solution you are trying to load and it is perfectly safe to delete it as it is regenerated when you load the solution.
If you are getting the unknown error when you haven't tried to load any solutions, this is probably not the right answer.

"Process with an Id of #### is not running" in Visual Studio

I am trying to run any program on visual studio 2013 update 3 and I get the following alert box:
Process with an Id of #### is not running.
Every time there is different ID number showing.
and in the error windows, I get this error message:
The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.
Sometimes it runs and in the browser I get the following message:
The webpage is not available.
Why is this occurring and how can I resolve it?
The following steps fix the problem for me:
Close Visual Studio
Navigate to the folder where your solution files are stored and delete the hidden .vs folder.
Restart Visual Studio
Hit F5 and IIS Express should load as normal, allowing you to debug.
Note: Based on my experience and others in the comments, this problem seems to be caused by moving a project between workstations, environments, or versions of Visual Studio. There must be some environment specific information contained in the .vs folder.
Open Visual Studio as an administrator
Right-click your project and click on 'Unload Project'
Again, right-click your project and click on 'Edit PROJECT_NAME.csproj'
Find the code below and delete it:
<DevelopmentServerPort>63366</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:63366/</IISUrl>
Save and close the file .csproj
Right-click your project and reload it
First Error
For the first error:
Process with an ID #### is not running.
The following steps worked for me:
Close all instances of Visual Studio.
Rename the IISExpress folder (in my PC is in C:\Users\jmelosegui\Documents).
Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1.
Start Visual Studio in administrator mode. (In Windows, right click the executable file and select Run as administrator).
Second Error
The second error:
The webpage is not available
What caused this error:
I deleted IIS Express Development Certificate while playing with the SSL.
The following steps worked for me:
Go to Control Panel.
Select Add/Remove Programs.
Locate IIS 8.0 Express.
Right click on it then click Repair.
Your certificate should be back!
With respect to the first error:
Process with an ID #### is not running
This situation will sometimes occur when IIS Express fails to bind to a port. A likely reason for that is that some other process has already bound to that port. Visual Studio will launch the IISExpress.exe process (which will fail to bind to the port and exit again) and then attach to the now-terminated process, resulting in the above error.
To check, note the port number in your project settings (e.g. 12116) and then try:
netstat -ano | find "12116"
If another process has the port open, this will give its PID. You can then choose to kill the offending process or reallocate your own port number.
If you are using a 64-bit machine
Then the problem maybe due to Visual Studio use of 32-bit IIS-Express.
Solution: In Visual Studio, go to Tools menu > Options > Projects and Solutions > Web Projects > Enable the option "Use the 64 bit version of IIS Express" and click ok
I had the same problem. Just restarting Visual Studio worked for me.
My fix was simple, I was missing prerequisites. I needed to install .NET Core SDK
Kilanny's answer is correct. Most machines in 2015 are 64bit, so there's a lot of chances that you just need to enable the 64bit option under the Tools main navigation link menu. No need to configure other files or hard code ports. Besides, port assignment should be dynamic. This fix applies to 2013 With Update 3 and Visual Studio 2015 Community Edition.
Check the images below for a mini tutorial:
(I'm just improving Kilanny's answer)
It looks like there are many solutions that work and some that don't...
My issue kept surfacing after a few test iterations.
Yes restarting the PC and/or VS would resolve the issue...but temporarily.
My solution was to undo a security change I had enabled a couple days
earlier to Controlled folder access under Ransomware protection.
I undid this change by:
(right click Start)
Setting->Update & Security->Windows Security->Virus & threat protection-> Virus & threat protection settings->Manage settings
Under Controlled folder access
Click->Manage Controlled folder access
(this is also the Ransomware protection screen)
Turn Controlled folder access off.
This was 100% the issue for me as I was able to run my test without restarting VS.
Another reason this can happen is for a .NET Core Web app if you upgrade the Microsoft.AspNetCore.Components.* NuGet package to a new version but don't install the new SDK,
In my case it was upgrading Microsoft.AspNetCore.Components.WebAssembly from 6.0.0 to 6.0.1 and didn't install .NET 6.0.1 SDK
go to Properties of the start up project, increment port number of the Project Url is probably the quickest way to get around this problem which I didn't read anyone mentioned yet.
And you don't need to restart VS as it can be a pain sometimes if you needed a few other instances needed to be running.
My solution to this on a new machine and fresh install of VS 2022 was to install the 3.1 framework. So check to make sure whatever framework the project is expecting is installed on your local machine.
I had a similar problem with Chrome. It appears that VS can't attach to the Chrome process for some reason.
Solution:
Close Chrome
With Chrome closed, start the web project and allow VS to open Chrome.
For me, none of the other solutions worked.
The things I tried:
Updating and patching everything associated with Visual Studio
Reinstalling Visual Studio
Reinstalling IIS Express
Several reboots
Adding the _WORKAROUND thing to the PATH
Renaming the IIS folder under documents to regenerate the IIS config
Manually editing the csproj file and removing the whole IIS settings section
Changing the IIS executable usage to 64bit in VS settings
Changing the port of IIS in the projects settings
After checking if the problem was persistent over different projects, it turned out that the problem only occurred in one specific projects. I figured that I had to delete all the user specific files in the solutions folder (such as bin, obj, *.suo, ...)
I just deleted the whole solution folder and reverted the files in git.
TLDR:
Try deleting user specific files/folders like bin, obj, *.suo, ...
Reboot your computer before trying any of these!
Some of these may be helpful. Doing the netstat trick
netstat -ano | find
helped me as another application was using my port, but didn't completely solve my problem. IIS Express still kept crashing. It wasn't until I rebooted my win 10 PC (first time in over a week), that my problem completely cleared up.
Head to the following directory
%userprofile%\documents\IISExpress\Config directory
Delete all files within that folder. Restart visual studio and works like a charm.
I had the same problem, and what needed to be done was setup IIS Express properly.
I right clicked on my project Properties => Web (tab) and on Servers:
Project URL was already pre-populated and I clicked the button "Create Virtual Directory".
I had just reinstalled (refreshed) windows and the IIS was not setup b/c it was new.
I came across the same problem and found that somehow the file 'applicationhost.config' (in ..\Documents\IISExpress\config) had a different localhost port number (in the 'sites' section) to the one specified in project\properties\web. Changed them to the same number and the problem went away
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Hit F5 and IIS Express should load as normal, allowing you to debug.
If this not working, then:
right click your solution and go to properties
Click left menu Web tag
Click checkbox "Override application root Url"
and run again your project.
For me this was the solution,
Close all running Visual studio instances
Open the solution folder and remove the .vs folder (hidden folder)
Open Run Command
Type iisreset and press Ok, and you may see a command prompt and
wait for it to complete and it will close automatically
Now Open visual studio and run your project, it should run.
So, nothing worked for me and this happened to happen to me when I got a new machine. Apparently it didn't have the older versions of .Net on it. Went into VS Installer and checked the box for .Net 5 Runtime (VS 2022). Working fine now on all .Net 5 Projects.
TL;DR: if you do have the right .NET Core (or .NET I guess) runtime installed, install any patch updates or reinstall the latest version if there aren't any.
Detail:
Similar to a couple of other answers where they just didn't have the right .NET core installed. I was trying to run a .NET Core 3.1 web app which had worked fine previously for months, and this suddenly started happening.
I did have 3.1 (runtimes 3.1.21 and 3.1.22) installed. However a new one (3.1.23) had been released 12 days earlier, and installing that fixed the problem.
I have no idea if this was because it's aware that there's a new patch and I didn't have it so it wouldn't run, or if there was just something wrong with my 3.1.22 installation. Worth trying installing latest patch, or reinstalling existing installations.
I encountered this while trying to run a project I'd run many times on a machine I'd used for the project many times. Cleaning up my IIS Express directory and my .vs directory didn't work, nor did setting environment variables. I even tried re-cloning my repository to a different folder, but no success.
By trying to run via command line, I found a more useful message:
dotnet run --project [startup project path]
I saw that the project was trying to run using .NET 6.0.5, but I only had .NET 6.0.4 installed. Installing the latest .NET 6.0.5 from the Microsoft website worked.
I also had the same problem, doing the above didn't work for me. What my error turned out to be was twofold.
I had Opera as my default browser and it couldn't attach to that.
I had multiple startup projects so it wouldn't let me switch to IE until I change the default startup project back to just the MVC shell.
I set that project specifically as the startup, then I switched it back to launching IE and it started debugging again.
What I did to make this go away:
Open C:\Users\gr_mext1\Documents\IISExpress\config\applicationhost.config and remove all <site> entries in <sites> do not remove <siteDefaults>!
In your project, go to Properties, Web and click "Create Virtual Directory".
Close and re-open visual studio, load your project and run
Fixed!
None of the listed solutions worked for me. Problem was some sort of conflicting state in local applicationhost.config file. Fix is easy, just delete one in your solution. For VS2015 it should be located in <path_to_your_solution>\Solution\.vs\config\. When you launch Debug, VS will recreate that file based on settings in your project file.
Deleting the hidden .vs folder didn't work for me since the port specified in my app was being used by another app. Doing the following worked for me:
Went to properties and then click the web tab.
Changed the port number in the Start Url and the Project URL.
Clicked Create Virtual Directory.
Save and Press F5.
cmd - regedit-HKEY_LOCAL_MACHINE-SYSTEM-CurrentControlSet-Services-HTTP-START=3
Computer restarted.
worked for me!
Tried most of the things here to no avail, but finally found a fix for my machine, so thought I'd share it:
Following previous advice in another question, I had used netsh to add :: to iplisten. It turns out undoing that was my solution, by simply replacing add in their advice:
netsh http delete iplisten ipaddress=::
You can also do this manually by deleting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList from the registry and restarting the service/your PC.
I update my Visual Studio to 2019 version and has this problem, I tried all solution from this question but it doesn't help to start my ASP.NET MVC 5 project with IIS Express. After I remove IIS Express (using Control Panel), download last version from www.microsoft.com and install it. After this everything works fine.
After some weeks i got update for Visual Studio and I got this problem again. I remove IIS Express and reinstall and it works fine now.
p.s. repair didn't help me, only uninstall and install.

Cannot edit checked out file (TFS) in Visual Studio 2013

Since I changed my windows password I can no longer type into a checked out file in Visual Studio 2013! Where before I just needed to start typing and it would check out the file in the background, now it won't even allow me to type into the file after I manually check the file out, from the solution explorer! It's as if VS 2013 is ignoring the keyboard on the project under source control. It's fine for other projects even project's under source control!
I think I remember seeing this before with older versions of Visual Studio and resolved it with a "Go online" option but I can't see that option in VS 2013, or the project is not "off line" so the option is not available.
This is obviously related to the TFS setting on the project but I simply cannot get past it. I am blocked and would appreciate any suggestions.
I suspended Resharper and restarted Visual Studio 2013. Once I reopened it the problem was gone. Resuming Resharper caused the problem to emerge again.
The solution is quite large so maybe that is it. Before putting Resharper into suspend mode I tried switching off code analysis thinking the workload is just too great, but that didn't help. The suspend did though. I hope this helps anyone else with the same issue.
All I have to do now is to figure out how to get Resharper back in the game without the problem coming back. We rely on Resharper as it is an wonderful tool. Since the solution has many projects in it, I am going to try create a smaller solution with my web project and just reference the other projects as assemblies. Maybe that will help
Update:
Clearing the resharper cache as suggested by Alexander resolved the original issue.
I'd like to add Alexander's comment as answer, since it helped me exactly to solve the issue:
Clean R# (ReSharper) caches by deleting all folders (and files) from the path
C:\Users\{User Name}\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches\
and then reopen the solution.
Note: (Thanks to Antak for providing this info!)
You can paste
%userprofile%\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches
into file explorer's path textbox (open it via Win+E, or use Win+R and paste the path into the command window), this will resolve the physical path into your user's directory automatically.
This happened to me. All my JavaScript files went "dead." By "dead" i mean that all the normal VS intellisense coloring/functionality was gone; js files were un-editable, although Resharper was still working sort of; all other non-js files seems to be normal. In addition to Resharper, I had also previously installed Web Essentials and was using both tools.
First, I cleared the R# caches as mentioned above by Alexander. After restarting VS, this DID NOT work. JS files still dead.
Then i disabled Web Essentials. Then I restarted. THIS WORKED.
I then re-enabled Web Essentials, restarted again, and all seems to be OK. Am crossing my fingers....
I too had this problem with the latest version of ReSharper (9.0.0.0), but clearing the cache as stated above did not work. I actually had to go into my ReSharper options (ReSharper -> Options -> General) and click the "Clear Caches" button. Once I did this and restarted VS everything is working again.
Try: /safemode
I had a similar problem where I could not edit most of my files, but I could edit *.ps1 files.
I don't have TFS, I do have resharper and other plugins.
What worked for me was:
Start visual studio in safe mode: C:\..\IDE>devenv /safemode
Close VS.
Start VS normally.
That probably has the same effect as suspending and resuming resharper, but I'm not sure which plugin could be causing the problem. If you are having trouble this is something you could try.
I hit the refresh(restart) and it solved a similiar problems so maybe you better try that before an IDE restar. ctrl shift F5

Visual Studio 2013 Search Solution Explorer fails to find files

So, I was using Visual Studio 2013, it crashed, and when I restarted it the Search Solution Explorer had stopped functioning correctly:
It fails to find any file if you type in the exact file name
It fails to find any static files e.g. HTML, CSS, JavaScript, etc.
It fails to find any configuration files e.g. Web.config
It seems to still find some files on a partial match, but not all files that you'd expect it to match e.g. if I search for Account I'd expect it to find AccountController.cs and AccountControllerTest.cs but it only finds the latter.
Some further info:
If I start VS 2013 in safe mode Search Solution Explorer works fine without any problems
If I manually disable or uninstall the extensions I'm using and start VS normally, the problem with Search Solution Explorer reappears
Has anyone come across anything similar to this, or got any suggestions of what to try to get Search Solution Explorer working again?
Update
I've had some joy running devenv /ResetSkipPkgs and devenv /ResetSettings. After a I ran those command Search Solution Explorer started working again, and works most of the time now. It still fails occasionally. Sometimes restarting Visual Studio will get it working again, but sometimes it just plain refuses to find certain files that are there.
Update 2
I installed Visual Studio 2013 Update 2, and Search Solution Explorer ran without any problems for just over a week before this problem reappeared. Restarting Visual Studio got Search Solution Explorer working again.
I was able to narrow this down to the extensions I was using, "Productivity Power Tools 2013" seems to break the search feature for me in IIS, so I've disabled it for now. I'm getting a full set of results when searching now.
I came to this conclusion by uninstalling all of my extensions and reinstalling them one by one until the problem reappeared.
A coworker also had some success with this solution, launching DevEnv.exe with /ResetSkipPkgs
http://msdn.microsoft.com/en-us/library/ms241276.aspx
Update
The problem returned for me after about 30 minutes, no specific cause noted. It was nice while it lasted. Removing all extensions gets me the same behavior as OP, only running in safe mode appears to work.
Deleting the .suo file also seems to fix the problem for a while, and then it comes back. I'm about to resort to a reinstall of vs2012 just to get this search feature back.
Please try to install VS2013 update 2 CTP before reinstalling everything and see if it fix the bug:
Weird that it works in Safe Mode, or that you manage to fix by removing extensiosn and it then re-appears...
but if some of your projects are in solution folders, then there is a known bug, fixed but not released yet apparently:
http://connect.microsoft.com/VisualStudio/feedback/details/801836/solution-explorer-doesnt-search-files-projects-inside-solution-folders
I have the same issue and confirmed it related to VS2013 Update 2 RC. Uninstall it will fixed this issue.
Wait for GM version of VS 2013 update 2.
I still had this issue both prior to and after installing VS update 3. I should note that it went away after I installed that for a while, and then came back. I suspect (but cannot confirm) that the broken behavior's return coincided with a lockup of my system which necessitated a reboot...
Anyway, I had the Productivity Power Tools installed, and after reading the answers here wondered if it might be complicit, and so I went to disable it and noticed it had a pending update. I went ahead and updated the add-on, and that resolved the issue for me (again). We'll see if it stays fixed.
This may caused by other extensions you have installed in your visual studio. I have some issue, found out Telerik JustTrace caused this issue.
Running devenv /ResetSkipPkgs will fix the problem but, as noted, it will return. For a permanent solution, add this parameter to the target in the exe's properties:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" -ResetSkipPkgs

What's the reason for error message? I am using VS 2010 professional edition

What's the reason for error message "The snapshot is out of date and cannot be used anymore because type tree has been updated, A new snapshow needs to be acquired"?
This error appeared right after I launched VS2010 and added username/pwd to connect to TFS repository.
I am using VS 2010 professional edition.
It happened to me with VS2012 as well after loading the project without source control binding, a local simple WinForms project. All I needed to do was Clean & Rebuild. After that the problem was solved.
This is a bug in Visual Studio. According to http://connect.microsoft.com/VisualStudio/feedback/details/742959/the-snapshot-is-out-of-date "We've taken a closer look at this problem and it isn't one that we'll be able to solve in the next release of Visual Studio."
They recommend waiting around until the background language parser service is done (or, in other words, don't try to be too productive there partner.) My experience is that closing all documents, cleaning the solution, rebuilding it and then closing and re-opening with a pause after does remove the error.
Until you do something silly, like edit code. Then all bets are off again as to when it reoccurs.
I had a similar issue with VS2012 and after rebuilding the solution twice, I still saw the same error message.
Following an advice from a post from this site, I closed the Designer tab, reopened it from the Solution Explorer, and the problem was resolved.
I got this error too, but after I unload project and reload project, the problem was resolved.
Simply restarting Visual Studio 2012 was a workaround for me, but it kept happening about every hour and having to restart visual studio that often was very annoying.
I also found this post which suggests that the Productivity Power Tools are the problem and to simply turn off the Automatic Brace Completion in Tools->Options->Productivity Power Tools. Since making this change I haven't seen the error message again :)
I'll note though that I am using Visual Studio 2012 and the OP is using Visual Studio 2010, but the Productivity Power Tools are available for VS 2010 too, so this may still fix the problem in VS 2010.
The same issue persists in VS2013, but no amount of Clean/Rebuild or restarting VS will help. The only way I can do a successful publish, is to disable the AutoT4MVC extension.
I got this error too. I closed Visual Studio 2012 and opened it again and the error was gone.
I got this error when I had conflicting class names / namespaces. I was referencing a UserControl from a different DLL in my XAML file which had the same name as my XAML file (class name). Maybe this helps.
I used Visual Studio 2012, and just faced this error on my Windows 8. It seems like Turning off the VM and restarting Visual Studio fixed the issue.
I just got this with VS2010.
I had a form with a user control (UCa) with a user control (UCa) from a different project on it. Made a change to the UCb then flicked to the designer for the form and boom! Snapshot error.
Resolved by a full clean and then rebuilding just the UCb project before building the rest of the project.
I'm using Visual Studio 2012, and I got this error when starting Visual Studio, letting TFS connect to the server, and THEN opening my solution. The fix was simply closing VS and launching the solution directly.
I'll throw my two cents in here as well.
I've tried every combination of Clean, Rebuild, Restart, etc. What I've found is that restarting Visual Studio usually makes the problem go away for at least one Publish. Here's the weird part, though. You can also fix the problem by doing absolutely nothing. If you just let Visual Studio sit for about a minute or two, and then publish, it will usually work just fine. There's some background voodoo going on here, and waiting for it to finish seems to do the trick.
I have a solution with two parts that need published. One is a WCF service application, and the other is the ASP.NET MVC5 website itself. Anytime I publish the services, and then try to publish the site I'll see this error. I can publish the services, restart VS, and then publish the site, OR I can publish the services, go get a drink, and then publish the site. As long as I give VS a chance to "settle" between any kind of rebuild and the publishing of the site, everything seems to work as expected.
Take a walk, come back, problem solved. OR if you don't have the time. Clean, Rebuild, Restart, Publish (lather, rinse, repeat).

Resources