2
votes

I am attempting to build my project into a zip, and have it move to a drop folder. The build succeeds and all the steps are fine, until the pipeline gets to the "Publish artifact" step. enter image description here

My .yml file is this:

 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'

I have tried several things to fix this, and nothing worked. I changed /p:PackageDirectory to /p: OutDir, and then files appeared in the drop folder, but it was not packaged, with the /p:PackageAsSingleFile appearing to be ignored. I also tried adding the zipAfterPublish flag to true in the VSBuild task, but it also did nothing. Anyone have any suggestions for what build args I could try in the build task or other areas that could be causing this issue? There are several existing similair pipelines that work totally fine in my Org with almost identical .yml files, so I almost think its due to the .sln configuration or something.

The sln file:


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

I am aware of the CopyFiles task but I have been asked not to use it.

Parts of the artifact creation log (too long to fully copy):


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]

1
Please add logs for this step 'Create Artifact For Solution'Krzysztof Madej
@Arik Not get your response for several days, would you please share your latest information about this issue? If you have any concern, feel free to share it here.Hugh Lin
@Arik had the same problem. Only workaround was to set D:\a\1\s\... to PathtoPublish. This should be a variable, but if it returns wrong path, no other solution was jet possible.Ziagl

1 Answers

0
votes

There is a problem with the VSBuild task definition in your yaml. There are no such arguments as command:'publish' and zipAfterPublish: true in VS build task.

- task: VSBuild@1
 displayName: 'Create Artifact For Solution'
 inputs:    
   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'    
  

You can refer to the task document for details.

enter image description here