DOTNETCORECLI@2 发布成功但没有工件

DOTNETCORECLI@2 Publish succeeds but no artifacts

我有一个遗留项目,想进入 Azure Devops 管道。我有一个构建管道设置并且构建似乎成功了。我添加了一个 DotnetcoreCli 发布任务并且成功了,但是在 运行 之后我没有任何可用的工件,所以无法实现发布管道。

想知道是否有人能发现我所做的任何愚蠢的事情?

这些是我的管道中定义的任务:

  - task: DotNetCoreCLI@2
    inputs:
      command: 'build'
      projects: '$(solution)'
      arguments: '--configuration $(buildConfiguration)'
    displayName: 'dotnet build $(buildConfiguration)'
  - task: DotNetCoreCLI@2
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/UAT'))          
    inputs:
      command: 'publish'
      publishWebProjects: true
      configuration: $(BuildConfiguration)
      arguments: '--output $(Build.ArtifactStagingDirectory) --verbosity detailed'
      zipAfterPublish: false # We want individual files published, not a zip

我的发布任务的跟踪到此结束:

(entry point): 2021-09-09T08:57:26.4983992Z Task "Message" 2021-09-09T08:57:26.4984515Z MYOrg.MyApp.UI -> D:\a\a\Staging\MYOrg.MyApp.UI\ 2021-09-09T08:57:26.4985051Z
Done executing task "Message". 2021-09-09T08:57:26.4985655Z
1>Done building target "Publish" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.4986271Z Target "_InitProjectCapabilityProperties" skipped. Previously built successfully. 2021-09-09T08:57:26.4991632Z 1>Target "_InitPublishIntermediateOutputPath" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\DotNetCLIToolTargets\Microsoft.NET.Sdk.DotNetCLITool.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_AspNetCoreProjectSystemPostPublish" depends on it): 2021-09-09T08:57:26.4992847Z Task "ConvertToAbsolutePath" 2021-09-09T08:57:26.4993300Z Done executing task "ConvertToAbsolutePath". 2021-09-09T08:57:26.4993889Z 1>Done building target "_InitPublishIntermediateOutputPath" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.4994986Z 1>Target "_TransformWebConfig" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_AspNetCoreProjectSystemPostPublish" depends on it): 2021-09-09T08:57:26.4996207Z Using "TransformWebConfig" task from assembly "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0....\tools\netcoreapp1.0\Microsoft.NET.Sdk.Publish.Tasks.dll". 2021-09-09T08:57:26.4997005Z Task "TransformWebConfig" 2021-09-09T08:57:26.5010124Z Configuring the following project for use with IIS: 'D:\a\a\Staging\MYOrg.MyApp.UI' 2021-09-09T08:57:26.5010856Z Updating web.config at 'D:\a\a\Staging\MYOrg.MyApp.UI\web.config' 2021-09-09T08:57:26.5129541Z Configuring project completed successfully 2021-09-09T08:57:26.5140303Z Done executing task "TransformWebConfig". 2021-09-09T08:57:26.5143720Z 1>Done building target "_TransformWebConfig" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5145086Z 1>Target "_TransformAppSettings" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_AspNetCoreProjectSystemPostPublish" depends on it): 2021-09-09T08:57:26.5146333Z Task "TransformAppSettings" skipped, due to false condition; ('$(_IsAspNetCoreProject)' == 'true' And '$(IsTransformAppSettingsDisabled)' != 'true' And @(DestinationConnectionStrings) != '') was evaluated as ('true' == 'true' And '' != 'true' And != ''). 2021-09-09T08:57:26.5153800Z
1>Done building target "_TransformAppSettings" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5156303Z 1>Target "_GenerateEFSQLScripts" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_AspNetCoreProjectSystemPostPublish" depends on it): 2021-09-09T08:57:26.5157868Z Task "GenerateEFSQLScripts" skipped, due to false condition; ('$(_IsAspNetCoreProject)' == 'true' And '$(IsGenerateEFSQLScriptsDisabled)' != 'true' And @(EfMigrations) != '') was evaluated as ('true' == 'true' And '' != 'true' And != ''). 2021-09-09T08:57:26.5180482Z 1>Done building target "_GenerateEFSQLScripts" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5183010Z 1>Target "_GenerateRunCommandFile" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_AspNetCoreProjectSystemPostPublish" depends on it): 2021-09-09T08:57:26.5185028Z Task "GenerateRunCommandFile" skipped, due to false condition; ('$(_IsWebJobProject)' == 'true' And '$(IsGenerateRunCommandFileDisabled)' != 'true') was evaluated as ('' == 'true' And '' != 'true'). 2021-09-09T08:57:26.5185862Z 1>Done building target "_GenerateRunCommandFile" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5186601Z Target "_PublishFiles" skipped, due to false condition; ('$(PublishProtocol)' != 'FileSystem' And '$(PublishProtocol)' != '') was evaluated as ('FileSystem' != 'FileSystem' And 'FileSystem' != ''). 2021-09-09T08:57:26.5187820Z 1>Target "_AspNetCoreProjectSystemPostPublish" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\DotNetCLIToolTargets\Microsoft.NET.Sdk.DotNetCLITool.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_DotNetCLIPostPublish" depends on it): 2021-09-09T08:57:26.5188885Z
1>Done building target "_AspNetCoreProjectSystemPostPublish" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5189885Z
1>Target "AfterPublish" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\Microsoft.NET.Sdk.Publish.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (target "_DotNetCLIPostPublish" depends on it): 2021-09-09T08:57:26.5190833Z
1>Done building target "AfterPublish" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5191798Z 1>Target "_DotNetCLIPostPublish" in file "C:\hostedtoolcache\windows\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\DotNetCLIToolTargets\Microsoft.NET.Sdk.DotNetCLITool.targets" from project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (entry point): 2021-09-09T08:57:26.5192771Z 1>Done building target "_DotNetCLIPostPublish" in project "MYOrg.MyApp.UI.csproj". 2021-09-09T08:57:26.5193415Z 1>Done Building Project "D:\a\s\MYOrg.MyApp.UI\MYOrg.MyApp.UI.csproj" (Publish target(s)). 2021-09-09T08:57:26.5210238Z 2021-09-09T08:57:26.5225190Z Build succeeded. 2021-09-09T08:57:26.5260048Z 0 Warning(s) 2021-09-09T08:57:26.5260950Z 0 Error(s)

执行 dontet publish 命令后,您需要制作 Azure Pipeline 工件。

你可以这样做:

- publish: $(Build.ArtifactStagingDirectory)
  artifact: WebApp

Here 你有这方面的文档。之后,您将获得可用于发布管道的工件。