VS2019 Debugger fails after renaming ClientApp folder in dotnet core angular app

偶尔善良 提交于 2019-12-23 17:57:07

问题


This question is similar to this other question. But the solutions to the other question prevent breakpoints from being set in the modified app.

I have Visual Studio Pro 2019 Preview Version 16.3.0 Preview 2.0 and .Net Core 3.0.100-preview8-013656.

  1. Run "dotnet new angular"

  2. Set a Typescript breakpoint in VS2019. Press F5 and check that it gets hit.

  3. Change name of Angular folder from ClientApp to XClientApp

  4. Make these changes in startup.cs:

    configuration.RootPath = "XClientApp/dist";
    ...
    spa.Options.SourcePath = "XClientApp";
    
  5. Make this change in the project file:

    <SpaRoot>XClientApp\</SpaRoot>
    
  6. Delete current node_modules folder - because during the "npm install", the absolute location of the Angular app folder gets hardcoded into many packages in about 2,000 places.

  7. Set a Typescript breakpoint in VS2019. Press F5 and observe that it is NOT hit.

  8. See open circle by breakpoint with error:

    "The breakpoint will not currently be hit. Breakpoint set but not yet bound."
    

Besides where it creates the "ClientApp" folder, where else does the SPA template have this string hardcoded into its code. And is there anyway to override this default?

[PS: My main goal is to put the WebApp code and the Angular code in seperate folders "Backend" and "Frontend". I tried first just changing the name, because I know that if I can't even change the folder name, there is no way I will be able to change the folder location. ]

Added info: I searched the source code for the angular spa template on GitHub. I found this additional reference to "ClientApp" in "AspNetCore\src\ProjectTemplates\Web.Spa.ProjectTemplates\content\Angular-CSharp.template.config\template.json". In sources -> modifiers -> exclude:

    "ClientApp/src/api-authorization/**",

More extra info: If I (1) run the app with F5, (2) press F12 in the Chrome Browser, (3) set a breakpoint using the Chrome Dev Tools, (4) hit & clear the breakpoint, then breakpoints will start working in Visual Studio. But I don't want to go through this each time to get breakpoints working.

来源:https://stackoverflow.com/questions/57649009/vs2019-debugger-fails-after-renaming-clientapp-folder-in-dotnet-core-angular-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!