简体   繁体   English

Visual Studio 2022 ASP.NET Core 6 Default application 和 Add folder to workspace in Chrome DevTools 不再工作

[英]Visual Studio 2022 ASP.NET Core 6 Default application and Add folder to workspace in Chrome DevTools is not working anymore

After some update to either Visual Studio (I have the same issue in both VS2019 and VS2022) or Chrome I can no longer update the CSS in DevTools and have it reflect and persist the changes to site.css file in my project.在对 Visual Studio(我在 VS2019 和 VS2022 中都有相同的问题)或 Chrome 进行一些更新后,我无法再在 DevTools 中更新 CSS 并让它反映并保留对我项目中site.css文件的更改。 Instead when I try to change a CSS property I get the following in the DevTools console:相反,当我尝试更改 CSS 属性时,我在 DevTools 控制台中得到以下信息:

Unable to find a stylesheet to update. Updating all local css files.
15:54:01.800 aspnetcore-browser-refresh.js:82 

And the green dot disappears from my CSS pane immediately after I hit the up or down arrow on my keyboard to try and change the CSS value.在我按下键盘上的向上或向下箭头尝试更改 CSS 值后,绿点立即从我的 CSS 窗格中消失。

Why is that?这是为什么? It used to work not too long ago.不久前它曾经工作过。 I think it's been broken for me for half a year or so now.我想它已经坏了半年左右了。

I've been googling but haven't find any good resources.我一直在谷歌搜索,但没有找到任何好的资源。 Or maybe I'm the only one coding directly in Chrome?或者也许我是唯一一个直接在 Chrome 中编码的人? :) Surely this can't be the case? :) 肯定不能这样吧?

If anyone knows a workaround please share because I'm really frustrated atm:)如果有人知道解决方法,请分享,因为我真的很沮丧 atm :)

Disabling "Enable CSS Auto-Sync" seems to do the trick.禁用“启用 CSS 自动同步”似乎可以解决问题。

在此处输入图像描述

Update 1: The above no longer works for me for some reason.更新 1:由于某种原因,上述内容不再适用于我。 I managed to find another fix on SO: https://stackoverflow.com/a/70096917/687549我设法找到了另一个解决方案: https://stackoverflow.com/a/70096917/687549

And here are some screenshots:这里有一些截图:

在此处输入图像描述 在此处输入图像描述

Update 2: Update 1 works when you only need to update the CSS directly in Chrome.更新 2:当您只需要直接在 Chrome 中更新 CSS 时,更新 1 有效。 It's better to have Hot Reload enabled and the set the following setting to None - then you'll get the best of both worlds (Hot Reload + Edit CSS directly in Chrome using workspaces): https://stackoverflow.com/a/68954979/687549最好启用热重载并将以下设置设置为None - 然后您将获得两全其美(热重载 + 使用工作区直接在 Chrome 中编辑 CSS): https://stackoverflow.com/a/68954979 /687549

Update 3: I'm now using VSCode.更新 3:我现在正在使用 VSCode。 If none of the above works try the following (block.js file in Network tab in Chrome DevTools): https://stackoverflow.com/a/68966524/687549如果上述方法均无效,请尝试以下操作(Chrome DevTools 中 Network 选项卡中的 block.js 文件): https://stackoverflow.com/a/68966524/687549

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

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