英文:
Make Visual Studio ignore wwwroot during development but still serve it while debugging
问题
我有一个SPA,其中API后端是在Visual Studio中用ASP.NET 6.0开发的,前端是用rollup构建/打包的。由于Visual Studio还应该托管前端文件,rollup会将它们复制到Visual Studio项目目录的wwwroot子目录。每次rollup将文件复制到wwwroot时,Visual Studio会消耗大量CPU。看起来好像它解析了所有文件,也许是为了智能感知?
然而,在这种情况下这是没有意义的,因为wwwroot的内容是rollup的构建输出。有没有办法告诉Visual Studio在开发过程中忽略这些文件,但在调试时仍然提供它们呢?
如果有更好的方法,我会感激任何建议。
我正在使用Visual Studio 17.4.4
英文:
I have an SPA where the API backend is developed in Visual Studio with ASP.NET 6.0
and the frontend is built/packed with rollup. Since Visual Studio should also host the fronend
files, rollup copies them to the subdirectory wwwroot of the Visual Studio project directory.
Every time rollup copies the files to wwwroot, Visual Studio consumes a lot of CPU. It looks
as if it parses all the files, maybe for Intellisense?
This doesn't make sense in this case, however, because the content of wwwroot is the built
output of rollup. Is there any way to tell Visual Studio to ignore these files during development
but still serve them when debugging?
If there are better ways to do this, I appreciate any recommendations.
I'm using Visual Studio 17.4.4
答案1
得分: 1
也许是实时分析的问题。
您可以在“解决方案资源管理器”中右键单击项目节点,然后选择“属性”,然后选择“代码分析”选项卡,在其中取消选中“在实时分析上运行”选项以禁用实时源代码分析。
有关更多详细信息,您可以参考此文档。希望这对您有帮助。
英文:
Perhaps this problem of live analysis.
You can right-click the project node in Solution Explorer and select Properties
, then select the Code Analysis
tab, uncheck the Run on live analysis
option to disable live source analysis.
For more details, youcan refer to this document. Hope this can work for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论