Azure DevOps:Blazor 部署在流水线构建中失败

时间:2021-02-13 20:46:27

标签: azure-devops blazor-webassembly

我有一个 Blazor WASM Pipeline Release 版本,在我升级到 .NET5 之前运行良好。 最近我收到以下错误:...\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(68,5): Error MSB4018: The "GenerateServiceWorkerAssetsManifest" task failed unexpectedly. 后跟 System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\a\1\s\ClientSide\BlazorProject\obj\Release\net5.0\service-worker-assets.js'.

我的 yaml 文件:

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/BlazorProject.csproj'
  solutionSln: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '$(solutionSln)'
    feedsToUse: 'select'
    noCache: true

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)/WebClient.zip"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    clean: true
    createLogFile: true

- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    azureSubscription: 'censored'
    appType: 'webApp'
    WebAppName: 'nextGenClientTest'
    packageForLinux: '$(build.artifactStagingDirectory)/WebClient.zip'

所以出于某种原因,我认为它找不到文件 service-worker-assets.js,但我不知道为什么。 对于那些想知道为什么结构可能很奇怪的人:我有一个用于恢复 nuget-packges 的解决方案文件,在这个管道中我只想构建一个特定的项目 BlazorProject.csproj(在我升级到.NET5)。

有谁知道,service-worker-assets.js 怎么了?

1 个答案:

答案 0 :(得分:1)

<块引用>

Azure DevOps:Blazor 部署在流水线构建中失败

有一个问题:

Blazor Service Worker Asset Manifest path construction bug

并且此问题已移至下一个 sprint 计划里程碑以供将来评估/考虑。并且 aspnetcore 团队在规划下一个里程碑的工作时会评估请求。

此外,为了确保您正确升级了您的项目,请参考以下文档了解更多详情:

Update Blazor WebAssembly projects