Home > Back-end >  What Data is Taken Into Account when using VSBuild@1 in a Azure Devops build pipeline?
What Data is Taken Into Account when using VSBuild@1 in a Azure Devops build pipeline?

Time:05-05

I have a step in my build pipeline that looks like this:

      - task: VSBuild@1
        inputs:
          solution: '$(solution)'
          msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
          platform: '$(buildPlatform)'
          configuration: '${{ parameters.configuration }}'

The artifacts end up being put into a .zip archive, and all is well, and I can extract that and copy it to the destination of my choice. But I'm wondering what, if anything, is done with information in the .pubxml file, which looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Texas</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>\\subdomain.webserver.com\qa\WebServices\APILocation\Texas</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
  </PropertyGroup>
</Project>

Later in my build pipeline, I'd like to copy the artifacts to the location specified in the publishUrl node of that .pubxml file. How can I access that information from within the pipeline?

CodePudding user response:

I'd like to copy the artifacts to the location specified in the publishUrl node of that .pubxml file. How can I access that information from within the pipeline?

You could deploy the pipeline with the .pubxml file:

  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      msbuildArgs: '/p:PublishProfile=$(Build.SourcesDirectory)\xxx\Properties\PublishProfiles\YourProfile.pubxml'
      platform: '$(buildPlatform)'
      configuration: '${{ parameters.configuration }}'

And if you have any other argument want to override the it in the build arguments,like:

/p:publishUrl=$(Build.ArtifactStagingDirectory)
  • Related