'Documentation for deploying Blazor WASM app to Azure Web Service
How are you deploying blazor wasm grpc-web apps to azure?
Azure CI pipeline for Blazor .NET 5 doesn't work
I would really like to solve this problem on my own so my first request is for a link to documentation: Is there a link to a document that provides an example .csproj and .yml pipleline for deploying a Blazor app to an Azure web service? I am deploying to a Virtual Application of an Azure App Service - not a static site. I am requesting both example .yml and .csproj files.
Absent the above, I am trying to deploy a standard .net 6 Blazor WASM app to an Azure Web Service. Configuration / error msg shown below. I have confirmed App Service configuration is .net 6, 64 bit, integrated pipeline. What am I doing wrong?
Pipeline:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- release/*
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2 // I have tried removing this
displayName: 'Use dotnet 6'
inputs:
packageType: 'sdk'
version: '6.x'
- task: DotNetCoreCLI@2
displayName: 'DotNet Restore NuGet packages'
inputs:
command: 'restore'
feedsToUse: 'select'
vstsFeed: 'MyFeed'
includeNuGetOrg: true
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Dotnet publish'
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory) --self-contained'
zipAfterPublish: True
- task: AzureRmWebAppDeployment@4
displayName: 'AzureRmWebAppDeployment@4'
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'My'
appType: webApp
WebAppName: 'MyWeb'
VirtualApplication: '/blazor'
packageforLinux: '$(Build.ArtifactStagingDirectory)/*.zip'
.csproj
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<GenerateAppxPackageOnBuild>enable</GenerateAppxPackageOnBuild>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier> // tried also win-x64
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
<ItemGroup>
//...
</ItemGroup>
</Project>
dotnet:
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
Also tried adding the following to the pipeline:
- script: dotnet workload install wasm-tools
displayName: 'Install wasm-tools workload'
Removed the following from .csproj
<GenerateAppxPackageOnBuild>enable</GenerateAppxPackageOnBuild>
<RunAOTCompilation>true</RunAOTCompilation>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<UseBlazorWebAssembly>true</UseBlazorWebAssembly>
Project builds and deploys however errors on page load:
Uncaught SyntaxError: Unexpected token '<'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
