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

Phil Hemstreet 1 Reputation point
2021-09-09T06:19:13.977+00:00

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

Blazor
Blazor
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
C#
C#
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
    2021-09-10T20:56:39.61+00:00

    @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 (SqlWork.com) 59,051 Reputation points
    2021-09-10T22:03:11.02+00:00

    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://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal

    0 comments No comments