Updated on Kisan Patel
Problem:
Getting an error when running dotnet publish
command.
“npm run build — –prod” error on Visual Studio 2017 .NET Core Angular Project.
Solution
Edit your .csproj file: Right click on you project – select Edit ____.csproj
Replace this:
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" /> <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
With this:
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build --prod" /> <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />