【发布时间】:2021-09-24 10:09:18
【问题描述】:
我在 Angular 中有带有前端的 .NET Core 应用程序。我想用特定的配置和主机运行我的应用程序。当我在脚本中添加到 package.json 时
"start": "ng serve --configuration=myconf--host myhost",
"build": "ng build --configuration=myconf"
我可以使用dotnet run 运行我的应用程序,一切正常,但我不想在我的package.json 中更改start 和build。我可以做某事吗
"start": "ng serve"
"start:myconf": "ng serve --configuration=myconf --host myhost",
"build": "ng build"
"build:myconf": "ng build --configuration=myconf"
在我的 package.json 中并在命令行中指定配置和主机?我试过dotnet run start:myconf 或dotnet run --configuration=myconf --host myhost 但它不起作用。
我可以用其他方式吗?
【问题讨论】:
-
这仅用于开发吗? .net 核心应用如何提供对 Angular 应用的访问?
-
是的,我只想在本地使用它进行开发。
-
您是否在使用带有 UseSpa() 的 dotnet new angular 项目模板?该代码块是如何配置的?