Azure DevOps:管道构建中的 Blazor 部署失败

Azure DevOps: Blazor Deployment fails in Pipeline Build

在我升级​​到 .NET5 之前,我有一个 Blazor WASM Pipeline Release 版本运行。 最近我收到以下错误: ...\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\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 怎么了?

Azure DevOps: Blazor Deployment fails in Pipeline Build

有一个问题:

Blazor Service Worker Asset Manifest path construction bug

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

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

Update Blazor WebAssembly projects