ASP.NET Core(.NET 5)+ Angular 11 =在空项目上生成错误

编程入门 行业动态 更新时间:2024-10-23 07:33:50
本文介绍了ASP.NET Core(.NET 5)+ Angular 11 =在空项目上生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我使用以下代码在Visual Studio中创建新的ASP.NET Core Web API + Angular项目 : dotnet new angular ,它将创建 .NET 5 项目,在ClientApp中包含一个新的 Angular 8.2 项目.如果我 F5 ,一切正常.

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.

但是我想使用Angular 11项目,所以我擦除了ClientApp内容,在那里打开了一个终端,然后: ng new< app-name>--directory ./在那里.

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.

创建的项目 F5 ,该项目将启动,但是每次启动时,这两行都会显示在调试控制台中:

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

Microsoft.AspNetCore.SpaServices:错误:-生成浏览器应用程序捆绑包...Microsoft.AspNetCore.SpaServices:错误:已完成浏览器应用程序捆绑包的生成.

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

我做了很多尝试:合并以前的 tsconfig.json , angular.json , launchSettings.json 中的值,但没有任何解决方案.相反,如果我从ClientApp目录启动 ng服务,它将正常工作.

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.

Visual Studio与Angular的CLI之间是否存在某些不兼容?预先谢谢大家!

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

推荐答案

我遇到类似的问题,甚至对此进行了询问.但是,正如答复所暗示的,这是Angular产生的结果的问题,它无意间看起来像是.NET的错误-基本上是草率的编码.

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.

虽然我认识到您的痛苦并与您分享,但您需要接受MS落后于Angular最新产品的情况.我认为您绝对应该继续使用11th(或任何最新版本).

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.

更多推荐

ASP.NET Core(.NET 5)+ Angular 11 =在空项目上生成错误

本文发布于:2023-11-17 06:57:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609226.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   项目   NET   ASP   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!