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

Phil Hemstreet 1 Reputation point

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:


  • task: VSBuild@1
    displayName: 'Build WebClient Project'
    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:

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

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,452 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,484 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,987 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,155 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 23,641 Reputation points Microsoft Employee

    @Phil Hemstreet , 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. Bruce ( 59,051 Reputation points

    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

    0 comments No comments