在 Azure Devops 构建管道中使用 VSBuild@1 时要考虑哪些数据?
What Data is Taken Into Account when using VSBuild@1 in a Azure Devops build pipeline?
我的构建管道中有一个步骤如下所示:
- 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 }}'
工件最终被放入 .zip 存档中,一切正常,我可以提取它并将其复制到我选择的目标位置。但我想知道,如果有的话,.pubxml 文件中的信息做了什么,看起来像这样:
<?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>
稍后在我的构建管道中,我想将工件复制到该 .pubxml 文件的 publishUrl 节点中指定的位置。我如何从管道中访问该信息?
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?
您可以使用 .pubxml 文件部署管道:
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:PublishProfile=$(Build.SourcesDirectory)\xxx\Properties\PublishProfiles\YourProfile.pubxml'
platform: '$(buildPlatform)'
configuration: '${{ parameters.configuration }}'
如果你有任何其他参数想在构建参数中覆盖它,比如:
/p:publishUrl=$(Build.ArtifactStagingDirectory)
我的构建管道中有一个步骤如下所示:
- 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 }}'
工件最终被放入 .zip 存档中,一切正常,我可以提取它并将其复制到我选择的目标位置。但我想知道,如果有的话,.pubxml 文件中的信息做了什么,看起来像这样:
<?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>
稍后在我的构建管道中,我想将工件复制到该 .pubxml 文件的 publishUrl 节点中指定的位置。我如何从管道中访问该信息?
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?
您可以使用 .pubxml 文件部署管道:
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:PublishProfile=$(Build.SourcesDirectory)\xxx\Properties\PublishProfiles\YourProfile.pubxml'
platform: '$(buildPlatform)'
configuration: '${{ parameters.configuration }}'
如果你有任何其他参数想在构建参数中覆盖它,比如:
/p:publishUrl=$(Build.ArtifactStagingDirectory)