question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fail to build when using dotnet spa templates

See original GitHub issue

I use the angular template of https://github.com/aspnet/templating, but electronizing it fails. The dotnet publish fails at the last step trying to build the SPA

<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
    <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
    <!-- Include the newly-built files in the publish output -->
    <ItemGroup>
      <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
      <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
      <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
        <RelativePath>%(DistFiles.Identity)</RelativePath>
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      </ResolvedFileToPublish>
    </ItemGroup>
  </Target>

Doing the ng build upfront and commenting the above part out of the csproj, makes it work perfectly. So there must be something going on with the publish function being called during start.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aboimpintocommented, Dec 14, 2018

hello … I’m having the same issue. I follow the tutorial https://www.youtube.com/watch?v=nuM6AojRFHk that says that we should use the SPA but the example is with a MVC and Controllers … the SPA return this strange error.

Can you please make a tutorial with SPA or tell us how to create this… please!!!

Paulo Aboim Pinto

1reaction
bravecobracommented, Oct 3, 2018

I just found these lines in the source code. https://github.com/ElectronNET/Electron.NET/blob/c1bd48b58de773967ca01b60407e6dc6ef10f9fa/ElectronNET.CLI/ProcessHelper.cs#L47-L50 Sorry to say but that’s unfortunately a naive way of interpreting the output. The build output of Angular does contain that word, because it has error handlers. It sure sounds like that’s the reason it fails…there must be another way to check for the actual exitcode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker - .Net core angular template dockerfile error
I am trying to create an image using the .net core angular spa template in visual studio 2017. I keep receiving the npm...
Read more >
Overview of Single Page Applications (SPA) in ASP.NET ...
The Single Page Application (SPA) templates for Angular and React offer the ability to develop Angular and React apps that are hosted inside ......
Read more >
SPA Angular template publish failure
I have built the application as follows: >dotnet new angular >npm install a) installed Ms.ASPNETCore.Server.IISIntegration
Read more >
blazor template can't build on cli
Hello dotnet new build blazor creates project. ... Error: rzc generate exited with code 1. ... blazor template can't build on cli.
Read more >
ASP.NET SPA Templates Proxy Changes from .NET 5 ... - InfoQ
After all the changes, build and run the application. Both Angular and React versions should follow the new proxy strategy and have HTTPS ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found