Publish a Blazor Server via Azure DevOps
I have a solution build with .NET6. The solution is quite basic:
- DashboardUI.Server is the ASP.NET Core hosted project
- DashbaordUI.Client is the Blazor application
I want to deploy this project in an Azure Web App. So, I also create a Release to publish the application in Azure in a Web App.
I have created the pipeline in Azure Devops copying one I use for deploying a Blazor Web Assembly project
# ASP.NET # Build and test ASP.NET projects. # Add steps that publish symbols, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 trigger: - main pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: UseDotNet@2 displayName: 'Use dotnet 6' inputs: version: '6.0.x' - task: DotNetCoreCLI@2 displayName: Restore inputs: command: 'restore' projects: '**/DashboardUI.Server.csproj' feedsToUse: 'select' - task: DotNetCoreCLI@2 displayName: Build inputs: command: 'build' projects: '**/DashboardUI.Server.csproj' arguments: '--configuration $(BuildConfiguration)' - task: DotNetCoreCLI@2 displayName: Publish inputs: command: 'publish' projects: '**/DashboardUI.Server.csproj' publishWebProjects: true arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)' - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact' inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: 'drop' publishLocation: 'Container' condition: succeededOrFailed()
The pipeline creates 2 zip files, one for the Server and one for the Client although I explicitly say
projects: '**/DashboardUI.Server.csproj'. When I run the Release, it fails because there is more than 1 project.
When I open the pipeline log, under
Publish, I see that the pipeline builds both projects and creates 2 zip files.
How can I fix it and build only the Server project?