我正在尝试将我的项目构建为 zip,并将其移至放置文件夹。构建成功并且所有步骤都很好,直到管道进入“发布工件”步骤。
我的 .yml 文件是这样的:
vmImage: 'windows-latest'
variables:
loggingsolution: 'LoggingService.sln'
steps:
- task: NuGetToolInstaller@1
displayName: 'Install Newer Version on NuGet'
inputs:
checkLatest: true
- task: NuGetCommand@2
displayName: 'Restore NuGet Packages for Solution'
inputs:
command: 'restore'
restoreSolution: '$(loggingsolution)'
feedsToUse: config
nugetConfigPath: ./Nuget.config
- task: VSBuild@1
displayName: 'Create Artifact For Solution'
inputs:
command: 'publish'
solution: '$(loggingsolution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)" /p:TransformWebConfigEnabled=false /p:AutoParameterizationWebConfigConnectionStrings=false /p:MarkWebConfigAssistFilesAsExclude=false /p:ProfileTransformWebConfigEnabled=false /p:IsTransformWebConfigDisabled=true'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
我已经尝试了几件事来解决这个问题,但没有任何效果。我将 /p:PackageDirectory 更改为 /p:OutDir,然后文件出现在放置文件夹中,但它没有被打包, /p:PackageAsSingleFile 似乎被忽略了。我还尝试在 VSBuild 任务中将 zipAfterPublish 标志添加为 true,但它也没有执行任何操作。任何人对我可以在构建任务或其他可能导致此问题的区域中尝试哪些构建参数有任何建议?有几个现有的 similair 管道在我的 Org 中运行良好,具有几乎相同的 .yml 文件,所以我几乎认为这是由于 .sln 配置或其他原因。
sln 文件:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2047
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logging", "Logging\Logging.csproj", "{D22352E8-7383-4C1F-927D-392192189B6E}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WcfService", "WcfService\", "{E0388E1A-6936-4372-BFAE-E83352E1E1B6}"
ProjectSection(WebsiteProperties) = preProject
SccProjectName = "SAK"
SccAuxPath = "SAK"
SccLocalPath = "SAK"
SccProvider = "SAK"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.7.2"
ProjectReferences = "{D22352E8-7383-4C1F-927D-392192189B6E}|Logging.dll;"
Debug.AspNetCompiler.VirtualPath = "/WCFService"
Debug.AspNetCompiler.PhysicalPath = "WcfService\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WCFService\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/WCFService"
Release.AspNetCompiler.PhysicalPath = "WcfService\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WCFService\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "1810"
SlnRelativePath = "WcfService\"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoggingWindowsService.Data", "LoggingWindowsService.Data\LoggingWindowsService.Data.csproj", "{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrameworkLoggingService", "FrameworkLoggingService\FrameworkLoggingService.csproj", "{D5EA8A2C-837E-4E1F-9921-781A77EFE191}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Release|.NET = Release|.NET
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D22352E8-7383-4C1F-927D-392192189B6E}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Release|.NET.ActiveCfg = Release|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Release|Any CPU.Build.0 = Release|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D22352E8-7383-4C1F-927D-392192189B6E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|.NET.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|.NET.Build.0 = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|.NET.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|.NET.Build.0 = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|Any CPU.Build.0 = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E0388E1A-6936-4372-BFAE-E83352E1E1B6}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|.NET.ActiveCfg = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|.NET.Build.0 = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|.NET.ActiveCfg = Release|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|.NET.Build.0 = Release|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|Any CPU.Build.0 = Release|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DACAB369-3A0B-4682-A7B1-C85E5378ACAC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|.NET.Build.0 = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|.NET.ActiveCfg = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|.NET.Build.0 = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|Any CPU.Build.0 = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D5EA8A2C-837E-4E1F-9921-781A77EFE191}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {53B5C897-49F6-401C-B6EC-B0DE0307B494}
EndGlobalSection
EndGlobal
我知道 CopyFiles 任务,但有人要求我不要使用它。
部分工件创建日志(太长无法完全复制):
Project "D:\a\1\s\LoggingService.sln" (1) is building "D:\a\1\s\WcfService.metaproj" (5) on node 1 (default targets).
Build:
Creating directory "WcfService\Bin".
Creating directory "WcfService\Bin".
Creating directory "WcfService\Bin".
Copying files from "D:\a\1\s\Logging\bin\" to "D:\a\1\s\WcfService\Bin\Logging.dll".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /WCFService -p WcfService\ -u -f -d PrecompiledWeb\WCFService\
Done Building Project "D:\a\1\s\WcfService.metaproj" (default targets).
Done Building Project "D:\a\1\s\LoggingService.sln" (default targets).
Build succeeded.
"D:\a\1\s\LoggingService.sln" (default target) (1) ->
"D:\a\1\s\Logging\Logging.csproj" (default target) (2) ->
(CoreCompile target) ->
D:\a\1\s\Logging\Log.cs(38,26): warning CS0618: 'ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings' [D:\a\1\s\Logging\Logging.csproj]
D:\a\1\s\Logging\Log.cs(39,83): warning CS0618: 'ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings' [D:\a\1\s\Logging\Logging.csproj]
D:\a\1\s\Logging\EnterpriseWebServiceAppender.cs(22,24): warning CS0169: The field 'EnterpriseWebServiceAppender._ServiceUrl' is never used [D:\a\1\s\Logging\Logging.csproj]
D:\a\1\s\Logging\Log.cs(27,31): warning CS0169: The field 'Log._currentAppender' is never used [D:\a\1\s\Logging\Logging.csproj]