Visual Studio regularly freezes running Microsoft.VisualStudio.Web.Host.exe - visual-studio-2012

Background
I maintain several web sites that are Visual Studio "Web Site Projects".
Problem
I've found that with a couple of these projects, Visual Studio regularly freezes while I'm working on the code. This doesn't happen for some of the web site projects, and I haven't seen it happen on any Web Application projects.
Symptoms
Each time it freezes, it takes about half a minute before I can use it again.
During a freeze, Windows Task Manager reports that Microsoft.VisualStudio.Web.Host.exe is maxing out one of the CPU cores.
Steps to Reproduce
Open a .cs file under the App_Code directory.
Make a change to the file.
Save the file.
Navigate somewhere else (eg switch tab, close the file, open different program in Windows).
Navigate back to the file (eg switch tab to it, open it, or go back to Visual Studio).
Other actions that sometimes seem to trigger the problem:
"Go to definition"
Opening a file
Previewing a file
Closing a file
Using a refactoring
"Find usages"
What I've Tried
Both Visual Studio 2012 and Visual Studio 2015
Changing the website project's build action
Disabling "Build Web site as part of solution"
Deleting web references and the Bin folder seems to minimise the problem, but obviously this breaks the web site. Maybe web site projects experience this problem when they contain a lot of C# code other than code-behind files?
Similar problems
I found the following potentially-related problems using Google, but none of them seemed to contain a workaround or solution.
Microsoft.VisualStudio.Web.Host.exe Time Theft
Microsoft.VisualStudio.Web.Host.exe
Visual Studio 2012 freezes for approximately 30 seconds after every build

I noticed that the problem happened less often when I suspended ReSharper.
The problem still happened occasionally when editing classes under App_Code, but restarting Visual Studio worked around it.

I was facing a similar problem. A single Web application project with dozens of class libraries, migrated over from VS 2010 into VS 2013.
I was able to solve my problem by disabling the "Hosting Process" option:
To disable the hosting process
Open an executable project in Visual Studio. Projects that do not
produce executables (for example, class library or service projects)
do not have this option.
On the Project menu, click Properties.
Click the Debug tab.
Clear the Enable the Visual Studio hosting process check box.
Full details on MSDN: http://msdn.microsoft.com/en-us/library/ms185330.aspx

Another option for people experiencing this on old web applications that don't have the properties page in the accepted answer above.
Disable "Allow this precompiled site to be updatable".
Open Site/Solution
Right click and view Property Pages
Go to MSBuild Options
Uncheck "Allow this precompiled site to be updatable"
This worked for me.

This problem stopped happening when the Web Site project was converted into a Web Application project.
Not an easy solution, but it did stop the problem.

They symptoms in the question of this post sound exactly like the nightmares I just had today:
Other actions that sometimes seem to trigger the problem:
"Go to definition"
Opening a file
Previewing a file
Closing a file
Using a refactoring "Find usages"
Plus intellisense wasn't working (even with CTRL + J) and
'Peek definition' was hanging as well.
I had to keep task killing visual studio (both 2015 and 2017).
My fix was to go into the project that I was having problems with, open the 'Package Manager Console' and uninstall and re-install the 'DotNetCompilerPlatform'
uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
and then
install-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
So far every problem I was encountering has not resurfaced (but this was just today so still need to give it time).
UPDATE:
It started creeping back again. I noticed also that whomever had installed to the solution had only done it to two of the various projects. Uninstalling the compiler platform (which means using the compilers that came with Visual Studio) has made life sane again.

Related

Visual Studio 2017. LNK1104: cannot open file ….\Debug\….exe after single successful build

I am having a very weird issue. I am able to build my C++/CLR Win Forms project with visual studio 2017 only once. Every next time I am getting “LNK1104 cannot open file ….\Debug\….exe” error.
What I have noticed is that after stopping debugging the program is still visible in Task Manager which is I believe the reason of getting the above message.
When I try to kill it am getting “access denied”.
The only way to compile the project is to restart visual studio. The process shuts down immediately together with visual studio. Once the visual studio is back on I can do a single build again.
I have tried to run "clean" project and solution.
I have also created new project and moved my files in it. What I have noticed is that before having my form filled with controls the problem was not appearing. It started happening after adding few textBoxes, ListView and buttons.
Any ideas how to fix it?
I figured out what was causing the issue. I have tried with switching off multiple Windows security features and finally I found the right one. The problem appeared to be a Windows 10 built in "Real-time protection" against malware. It can be disabled under "Virus & threat protection settings".

wsdl definition not being updated even after closing iis site

I am using visual studio pro 2012 edition, one of our developers updated the wsdl definitions on a webservice without telling us and for a while i couldnt figure out why the wsdl definitions werent being updated. I did clean and build of the services, stopped the site and even exited IIS Express. Turns out if you have the solution open in visual studio with the old wsdl definition, the new definitions are not updated after pulling latest(svn). I tried several times and the only solution is to close visual studio and restart using the latest codebase.
anyone else experience this? could be a bug in vs2012 only?
I figured out what happened, my colleague copied over the hidden folder .vs folder which had the applicationhost.config file pointing to their username, vs2012 does not give any errors and happily runs the service but it serves the old pages. VS2015 shows an error page which is how i found out the problem.

Pressing Ctrl + S automatically opens Output window

Whenever i press Ctrl+S from keyboard or whenever i click on any file in Solution Explorer it automatically opens output window only in Visual Studio 2012.
I tried
Tools > Options > Projects and Solutions > Show output window when build starts
I am using Visual Studio Professional 2012
But its just not working. Its irritates a lot. Please suggest how to get rid of it.
if someone is facing this issue in visual studio community 2015, in my case the issue was caused because of the use of Backup and sync utility from google, I have synced my source directory to my google drive to maintain the latest copy of source backed up.
The backup utility locks the file which you might be editing for syncing it to cloud storage. since the file is locked by another process, the visual studio cannot save the changes in the file.
The fix was to pause the syncing for the time you are doing frequent changes.
In your case, it might be some other process which might be locking the file.
If you're using an extension, one of them could be the reason.
I had the same problem while saving the CMakeLists.txt files. I checked one of the extension's setting, "CMake Tools", it has a "Cmake: Reveal Log" settings which causing this problem. I simply deactivated it
I suggest you to check extensions' settings or try to find on settings with searching "output", "focus" etc.

Publishing projects without VS Publish

Our team has been having quite a lot of trouble with Visual Studio's publish feature. We use TFS and are all running VS 2012 ultimate. It works fine when only one person is involved in a project, but when we get many people inside one project, the publish profiles get off and Visual Studio reports a successful publish even when all files haven't been copied up. I've read all the SO questions about why this happens and I understand that TFS adds the publish profiles to the source control automatically. If we create a new publish profile and republish, everything works. But this is not sustainable. I can't prevent VS from automatically adding the publish profiles to TFS (if we could, I think this would solve the problem) so I'm now looking for better ways to publish an application to a web server. Is there a better tool out there to publish web applications or do I need to write my own VS extension?
Per this question (https://stackoverflow.com/a/12393154)
The temporary answer seems to be to change your settings from release to debug, save, then switch it back. This causes the pubxml.user file to be rebuilt, which is actually the problem.

web essentials 2012 crashes when I open a project that already has a file open

An interesting things is happening and I was hoping someone would be able to help me with it.
Visual Studio 2012 with Web Essentials installed was working fine until the latest update (the one where they removed less, coffeescript, etc.)
However since the update, I am having problems. This only happens when I open a project that has a file - which web essentials would act upon - already open.
If I close all of the tabs with cshtml/less/css files before I close a project. Then the next time I open that project, I am fine. I can even open those files, and web essentials kicks in with all of its extra features. But if even one of those files are open when the project was saved, and therefore opened automatically when the project is loaded, then the entire visual studio crashes.
Any help would be appreciated.
Thank you
Found the issue after days and days of searching (only minutes after posting this question :))
The latest version of Web Essentials requires ASP.NET and Web Tools 2012.2
I had heard a lot about these Tools 2012.2 but I thought that they were an extension - maybe the "Microsoft Web Development Tools" installed automatically with visual studio or something that would get upgraded automatically with all of the auto updating software running on my machine.
So I tried updating all of the extensions and refreshing and refreshing and searching for updates - to no avail.
I even downloaded and installed VS2012 Update 2 CTP4 thinking that that must be this elusive update that everyone is talking about.
Well as I'm sure you guessed, its actually none of the above.
The link is http://go.microsoft.com/fwlink/?LinkId=282650
It is listed on the home page of web essentials but not on the page that pops up when you run the update.
I hope this link helps someone.

Resources