skip to Main Content

I created an ASP.NET Core app with Angular as instructed via this guide. I’m publishing it to Azure using the GitHub Action support, which was generated by Azure and then I modified to get it to work. I’ve got it working for my app but only the API seems to publish, and at the designated endpoint URLs. This makes sense since I had to modify the workflow to indicate the API project directly. How can I publish the Angular app (in the UI project) to Azure as well with this same workflow?

Here is the repo for reference: https://github.com/rarDevelopment/rardk-web-dotnet
The workflow: https://github.com/rarDevelopment/rardk-web-dotnet/blob/main/.github/workflows/main_rardkweb.yml
and the API sample endpoint can be seen running here: https://rardkweb.azurewebsites.net/WeatherForecast

2

Answers


  1. Chosen as BEST ANSWER

    I ended up going with a different approach, using this guide: https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-angular?view=vs-2022

    From scratch, it was much easier because it got the app working locally and then the publish step also created the necessary Azure resources automatically.


  2. the Angular app will get published via npm run build , it says so also in the guide you linked, here

    The publish process takes more time than it does for just an ASP.NET Core project, since the npm run build command gets invoked when publishing.

    In dotnet static files are stored within the project’s web root directory.

    Your angular project should be configured to publish the result of npm run build in the web root directory (www) of your dotnet project.

    When the built Angular app is in the www directory, then you build/publish the dotnet project, which needs to be configured (see the guide examplecode) to serve static files.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search