ASP.NET Core (.NET 5) + Angular 11 = build error on empty project

假装没事ソ 提交于 2021-02-10 02:49:31

问题


If I create a new ASP.NET Core Web API + Angular project in Visual Studio using: dotnet new angular, it creates a .NET 5 project containing in the ClientApp a new Angular 8.2 project.
If I F5 it, everything works perfectly.

But I want to use and Angular 11 project, so i wipe the ClientApp content, open a terminal there and: ng new <app-name> --directory ./ there.

Project created, F5, the project launches but at every launch these 2 lines appear in the Debug Console:

Microsoft.AspNetCore.SpaServices: Error: - Generating browser application bundles... Microsoft.AspNetCore.SpaServices: Error: √ Browser application bundle generation complete.

I did many attempts: merging values from previous tsconfig.json, from angular.json, launchSettings.json, but nothing solved it.
Instead, if I launch an ng serve from the ClientApp directory, it works without errors.

Is there some incompatibility between Visual Studio and Angular's CLI? Thank you all in advance!


回答1:


I get similar issues and even asked about it. However, as the replies suggest, it's a matter of Angular producing results that unintentionally look like errors to .NET - basically a case of sloppy coding.

While I recognize your pain and do share it with you, you'll need to accept that MS is a bit behind Angular latest stuff. You should definitely keep going with 11th (or whatever version is the latest), in my opinion.



来源:https://stackoverflow.com/questions/65465740/asp-net-core-net-5-angular-11-build-error-on-empty-project

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