Visual Studio 2013, changes not showing in debug

2019-01-14 13:27发布

问题:

Have recently upgraded to Visual Studio 2013 Pro and am having some teething problems.

Primarily if I change any HTML or CSS in either a .aspx page for Web Forms or .cshtml for MVC, the changes aren't always reflected on the page I'm working on when I debug it and don't appear not matter how times I refresh or clear my cache.
Am using web essentials, which should put the changes straight on the page with have to refresh the page but this doesn't seem to be working either.

Also occasionally, but not always, if I stop debugging, change the code behind then run the project again it says it's running from a different version of the code than the one being debugged and I have to stop it, rebuild and then debug.

Have never had these problems on previous version of Visual Studio.

Any suggestions?

回答1:

Go to Tools-Options

Under Projects and solution -> Build and Run select "Always build" under "On Run, when projects are out of date"



回答2:

I had the same issue today. I already had that setting on (Always Build). Cleaning & rebuilding the solution didn't do the trick. I looked under C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\ and I found a folder named root with a lot of temporary hexa-numeric named folders. Only one folder had today's date. I closed all VS 2013 windows and removed that folder. After I restarted VS 2013 I simply run the project and my changes are now back.



回答3:

I was experiencing old code in the debugger with a console application calling a DLL. I believe it was occurring because the previous version of the DLL was installed in the Global Assembly Cache (GAC), and the Visual Studio debugger was calling the DLL in the GAC (Which had the old code) instead of the current version. I uninstalled the DLL from the GAC and the problem was resolved.

Uninstall an assembly from the GAC (MSDN)



回答4:

I had this issue and tried all the Build config changes etc without success. I'm running VS2015 in a Parallels VM and saving the project on a drive on the Mac. It appears that there is some odd/tiny difference between the Mac time stamps and the Win10 clock.

Setting the Win10 clock back 5 seconds resolved the issue. Bizarre but saved my sanity...



回答5:

for my case, I tried all the before mentioned answers but nothing worked. and then I went to the system logs and found a hint about failure in loading IIsexpress for the running application. I changed the port that the application used and voila! everything is back to normal. thought this might help someone



回答6:

I had a similar issue and found the solution by checking the path of the virtualDirectory for your sites that are found within your applicationhost.config file.

Typically located here: C:\Users{your user name}\Documents\IISExpress\config

You want to make sure the physical path for both locations are the same since sometimes they get wonky when working on various branches/projects etc.



回答7:

I just spent the past hour trying every answer and none of them worked. I simply cleared the cache on the browser I was using to debug (google chrome) and it updated my changes. This question had the correct answer: visual studio not updating html / javascript to server / browser



回答8:

it's not a bug at all, and has nothing to do with the above answers.

Go to solution explorer and click on --> sync with active document. as shown bellow: