本文介绍了dotnet core 2.1 angular app-重命名ClientApp文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不在dotnet core 2.1单页应用程序模板中重新设计一个有角度的应用程序。

I had to redesign an angular app in a dotnet core 2.1 single page application template.

我在普通文件夹旁边的新文件夹 Frontend中完成了此操作ClientApp文件夹。在本地它可以正常工作,但是当我部署它或尝试通过 dotnet publish发布它时,它将始终使用ClientApp文件夹。

I did it in a new folder "Frontend" next to the normal "ClientApp" folder. Locally it works fine, but when I deploy it or try to publish it by "dotnet publish" it always takes the ClientApp folder.

可以替换或重命名

推荐答案

我相当确定您可以通过更改Startup.cs

I'm fairly certain you can accomplish this by changing the Startup.cs

spa.Options.SourcePath = "ClientApp";

...并更改生产构建路径:

...and change the production build path:

services.AddSpaStaticFiles(configuration =>
{
    configuration.RootPath = "ClientApp/dist";
});

...然后在project_name.csproj中修改路径:

...then modify your path in project_name.csproj:

<SpaRoot>ClientApp\</SpaRoot>

这篇关于dotnet core 2.1 angular app-重命名ClientApp文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 23:21