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

问题描述

我不得不在 dotnet core 2.1 单页应用程序模板中重新设计一个 angular 应用程序.

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

我是在普通ClientApp"文件夹旁边的一个新文件夹Frontend"中完成的.在本地它工作正常,但是当我部署它或尝试通过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.

是否可以分别替换重命名ClientApp文件夹?

It is possible to replace respectively rename 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 应用程序 - 重命名 ClientApp 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:11