简体   繁体   English

Visual Studio 2013,更改未在调试中显示

[英]Visual Studio 2013, changes not showing in debug

Have recently upgraded to Visual Studio 2013 Pro and am having some teething problems. 最近已升级到Visual Studio 2013 Pro,并且遇到了一些麻烦的问题。

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. 主要是,如果我在Web窗体的.aspx页或MVC的.cshtml页中更改了任何HTML或CSS,则这些更改并不总是反映在调试时正在处理的页面上,并且无论如何都不会出现刷新或清除缓存的次数。
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. 在以前的Visual Studio版本中从未遇到过这些问题。

Any suggestions? 有什么建议么?

Go to Tools-Options 转到工具-选项

Under Projects and solution -> Build and Run select "Always build" under "On Run, when projects are out of date" 在“项目和解决方案->构建并运行”下,选择“在运行时,项目已过期”下的“始终构建”

在此处输入图片说明

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. 我查看了C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ Temporary ASP.NET Files \\,发现一个名为root的文件夹,其中包含许多临时的六数字命名文件夹。 Only one folder had today's date. 只有一个文件夹具有今天的日期。 I closed all VS 2013 windows and removed that folder. 我关闭了所有VS 2013窗口并删除了该文件夹。 After I restarted VS 2013 I simply run the project and my changes are now back. 重新启动VS 2013之后,我只需运行项目即可,所做的更改现已恢复。

I was experiencing old code in the debugger with a console application calling a DLL. 我在调试器中使用调用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. 我相信这是因为DLL的先前版本已安装在全局程序集缓存(GAC)中,并且Visual Studio调试器正在GAC中调用DLL(其中有旧代码)而不是当前版本。 I uninstalled the DLL from the GAC and the problem was resolved. 我从GAC卸载了DLL,问题已解决。

Uninstall an assembly from the GAC (MSDN) 从GAC (MSDN) 卸载程序集

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. 我在Parallels VM中运行VS2015,并将项目保存在Mac上的驱动器上。 It appears that there is some odd/tiny difference between the Mac time stamps and the Win10 clock. 看来Mac时间戳和Win10时钟之间有些奇怪/微小的差异。

Setting the Win10 clock back 5 seconds resolved the issue. 将Win10时钟设置为5秒钟即可解决此问题。 Bizarre but saved my sanity... 怪异但救了我的理智...

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. 我遇到了类似的问题,并通过检查在applicationhost.config文件中找到的站点的virtualDirectory路径找到了解决方案。

Typically located here: C:\\Users{your user name}\\Documents\\IISExpress\\config 通常位于以下位置:C:\\ Users {您的用户名} \\ 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. 您要确保两个位置的物理路径都相同,因为有时在进行各种分支/项目等工作时它们会变得很奇怪。

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. 然后我转到系统日志,发现有关为正在运行的应用程序加载IIsexpress失败的提示。 I changed the port that the application used and voila! 我更改了应用程序使用的端口,瞧! everything is back to normal. 一切恢复正常。 thought this might help someone 认为这可能对某人有帮助

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 这个问题的答案是正确的: Visual Studio无法将html / javascript更新为服务器/浏览器

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: 如下所示: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM