Azure, Visual Studio: Add your Ionic/Angular/PWA (serverless computing?)

You’ve got a C# webapi that you’ve written in Visual Studio. You’ve got one or more Angular/Ionic/PWA front-endd. You want to host your front-end on the same Azure web app as the web api.

In VS Code, edit your angular app and make sure the API points to your url http://allmyapps.azurewebs.net/api

Compile your angular app using –prod

ionic build --prod

In VS, create a MyDogsApp folder, then create a Pre-Build Event

xcopy C:\Projects\MyDogs\www*.* C:\Projects\myapps\MyDogsApp /E /Y

In VS, build your project, and make sure the built files from your angular app get copied to the folder within your VS project

In VS, UNLOAD your project.

Now Edit your project (.csproj)

Add an ItemGroup

<ItemGroup>
    <Content Include="MyDogsApp\**" CopyToOutputDirectory="Always" />
</ItemGroup>

In VS, Reload your project.

In VS, Publish your project to a folder and check the MyDogsApp files are in a folder next to Content.

Next time you build, the latest build will be copied to the folder within your project. Then when you publish, those files will be copied to the output. So you can get to your wonderful front-end using

  https://allmyapps.azurewebsites.net/MyDogsApp

Website by Daneswood