将 MSBuild 内容检索到工件中?目录 'D:\a\a' 是空的。不会添加任何内容来构建工件 'drop'
Retrieving the MSBuild content into an artifact? Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'
我试图了解此 MSBuild 命令如何与 Yaml 中的 Azure DevOps Pipeline 一起工作。我收到此错误:
这是我在 Azure Pipeline 项目中的 MSBuild 指令:
- task: MSBuild@1
inputs:
solution: '**/Beper-EDI.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: # Optional
clean: true
#maximumCpuCount: false # Optional
#restoreNugetPackages: false # Optional
#logProjectEvents: false # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed,
构建正确。我可以构建我的项目。然后我尝试使用以下方式发布我的工件:
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: 'drop'
pathToPublish: '$(Build.ArtifactStagingDirectory)'
我可以处理管道,但最后我的工件是空的。
在构建过程中,我可以看到创建了 bin/Release 文件夹和 obj/Release 文件夹并编译了代码。:
Starting: MSBuild
==============================================================================
Task : MSBuild
Description : Build with MSBuild
Version : 1.192.2
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/msbuild
==============================================================================
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\s\Beper-EDI.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=D:\a\s"*ForwardingLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="Any CPU" /p:configuration="Release" /p:_MSDeployUserAgent="VSTS_10aa52a5-54c3-4730-90df-e99d0388b1f5_build_50_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 12/30/2021 8:07:45 AM.
Project "D:\a\s\Beper-EDI.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "D:\a\s\Beper-EDI.sln" (1) is building "D:\a\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) is building "D:\a\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) is building "D:\a\s\Submodules\nppg-core\Nppg.Core\Nppg.Core.csproj" (5:3) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
如何确保系统允许我访问我的 /Release 文件夹?
Retrieving the MSBuild content into an artifact? Directory 'D:\a\a' is empty. Nothing will be added to build artifact 'drop'
那是因为PublishBuildArtifacts
任务的来源是$(Build.ArtifactStagingDirectory)
。
但是MSBuild任务没有在$(Build.ArtifactStagingDirectory)
文件夹中生成文件,所以我们需要通过复制任务将文件从任务MSBuild的输出文件夹复制到文件夹$(Build.ArtifactStagingDirectory)
MSBuild 任务:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**\bin\release\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
我试图了解此 MSBuild 命令如何与 Yaml 中的 Azure DevOps Pipeline 一起工作。我收到此错误:
这是我在 Azure Pipeline 项目中的 MSBuild 指令:
- task: MSBuild@1
inputs:
solution: '**/Beper-EDI.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: # Optional
clean: true
#maximumCpuCount: false # Optional
#restoreNugetPackages: false # Optional
#logProjectEvents: false # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed,
构建正确。我可以构建我的项目。然后我尝试使用以下方式发布我的工件:
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: 'drop'
pathToPublish: '$(Build.ArtifactStagingDirectory)'
我可以处理管道,但最后我的工件是空的。
在构建过程中,我可以看到创建了 bin/Release 文件夹和 obj/Release 文件夹并编译了代码。:
Starting: MSBuild
==============================================================================
Task : MSBuild
Description : Build with MSBuild
Version : 1.192.2
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/msbuild
==============================================================================
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\s\Beper-EDI.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=D:\a\s"*ForwardingLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="Any CPU" /p:configuration="Release" /p:_MSDeployUserAgent="VSTS_10aa52a5-54c3-4730-90df-e99d0388b1f5_build_50_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 12/30/2021 8:07:45 AM.
Project "D:\a\s\Beper-EDI.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "D:\a\s\Beper-EDI.sln" (1) is building "D:\a\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) is building "D:\a\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) is building "D:\a\s\Submodules\nppg-core\Nppg.Core\Nppg.Core.csproj" (5:3) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
如何确保系统允许我访问我的 /Release 文件夹?
Retrieving the MSBuild content into an artifact? Directory 'D:\a\a' is empty. Nothing will be added to build artifact 'drop'
那是因为PublishBuildArtifacts
任务的来源是$(Build.ArtifactStagingDirectory)
。
但是MSBuild任务没有在$(Build.ArtifactStagingDirectory)
文件夹中生成文件,所以我们需要通过复制任务将文件从任务MSBuild的输出文件夹复制到文件夹$(Build.ArtifactStagingDirectory)
MSBuild 任务:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**\bin\release\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'