question

PhilHemstreet-0075 avatar image
0 Votes"
PhilHemstreet-0075 asked MahmoudSayedAboElNaga-3353 commented

Only the wwwroot folder items get generated into the drop folder when deploying blazor web assembly via DevOps

I am attempting to deploy my web app to an Azure Web App via Azure Dev Ops, however, my build only produces the wwwroot folder and the web.config. The yaml for the build is as follows:

steps:
- task: VSBuild@1
displayName: 'Build WebClient Project'
inputs:
solution: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.csproj
vsVersion: 16.0
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\\" '
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'


Are there other MSBuild args that I should be including? The project directory looks like this:
130637-screenshot-2021-09-09-011413.jpg



I have tried to read through the MSBuild documentation and haven't been able to find an argument that seems to fit.

Edit: When deploying directly through visual studio, the deploy runs without a hitch

dotnet-csharpazure-webappsdotnet-aspnet-core-blazorazure-webapps-content-deploymentazure-dev-tool-integrations
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered MahmoudSayedAboElNaga-3353 commented

@PhilHemstreet-0075, Just to highlight from App Service stand-point (//will let dotnet/blazor SMEs/community (| tag) to share additional thoughts) - Under the cover, all of deployment options uses the Kudu deployment engine. For Azure Dev Ops, Kudu only support git repository.

There is a different is the two-deployment options Kudu vs Azure dev Ops, see VSTS vs Kudu deployments - The build process and build environment are not identical in both cases. e.g. they may not have exactly the same version of the SDKs, as they update on different schedules.

Web packages created via the MSBuild task (with default arguments) have a nested folder structure that can be deployed correctly only by Web Deploy. The publish-to-zip deployment option can't be used to deploy those packages.

To change the deployment option in designer task, you may expand Additional Deployment Options and enable Select deployment method to choose from additional package-based deployment options. Via - task: AzureWebApp@1 , see the detailed steps and sample yaml file.
See this doc - Azure Web App task.
Deployment method for the app. Acceptable values -are auto (default), zipDeploy, runFromPackage

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Additionally,

Also, for (Remove additional files at destination) parameter-
- (Optional) Select the option to delete files on the Azure App Service that have no matching files in the App Service package or folder.

Blazor WebAssembly apps can be deployed to Azure App Services on Windows, which hosts the app on IIS.
Deploying a standalone Blazor WebAssembly app to Azure App Service for Linux isn't currently supported. A Linux server image to host the app isn't available at this time.
https://docs.microsoft.com/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-5.0#azure-app-service-1

0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

a blazor client app is just a static web site. a web deploy should only deploy the wwwroot folder (the static site) and a web.config for IIS to host the wwwroot files.

the web.config has some rewrite rules to map wwwroot to root of site.

wwwroot\index.html is the application default page

if you want to host as azure static website, then just deploy the wwwroot contents to azure storage blog container $web

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.