我有一个ASP.NET Core2.0应用程序,和Angular 5 SPA托管在同一个文件夹中。
目前,要部署到IIS,我执行以下操作:
// First publish the release configuration
dotnet publish -c release
// Now delete the wwwroot directory as it is pulished with ng build
rm -r bin/release/netcoreapp2.0/publish/wwwroot
// Build the prod version of the angular app
ng build --prod
// copy the new wwwroot folder into the publish folder
cp -R wwwroot bin/release/netcoreapp2.0/publish/这是非常震撼的..。如何让dotnet publish运行ng build --prod?
我已经尝试将以下内容添加到我的项目csproj文件中:
<Target Name="AngularBuild" AfterTargets="Publish">
<Exec Command="npm run build --prod" />
</Target>发布于 2018-03-04 16:13:44
您可以使用任何任务运行器或自定义脚本逐个调用所有这些命令。
例如,您可以在package.json中定义自定义npm脚本
{
...
"scripts": {
"apppublish": "dotnet publish -c release && npm run build --prod",
...
}
}当你需要发布应用时,只需调用npm run apppublish即可。
发布于 2018-05-28 15:11:35
在.csproj中
<Target Name="Build Angular" Condition="'$(Configuration)'=='Release'" BeforeTargets="Build">
<Message Text="* * * * * * Building Angular App * * * * * *" Importance="high"/>
<Exec Command="npm run build"/>
</Target> 然后在package.json中
"scripts": {
"build": "npm run build --prod"
}https://stackoverflow.com/questions/49093152
复制相似问题