Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 214
Sergio Avatar asked Dec 27 '20 12:12

Sergio


1 Answers

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.

like image 81
Konrad Viltersten Avatar answered Oct 26 '22 23:10

Konrad Viltersten