【发布时间】:2020-02-23 10:56:29
【问题描述】:
我有一个 ASP.NET 项目,我想使用 Azure 管道实现 CI-CD,以部署到自定义服务器 (IIS)。 目前,当使用 Visual Studio(2019) 手动发布 Web 应用程序时,我使用这些选项来发布配置文件:
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\Test</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>MergeEachIndividualFolder</WDPMergeOption>
<UseMerge>True</UseMerge>
</PropertyGroup>
我想要实现的主要目标是在使用构建和发布管道进行部署时实现<WDPMergeOption>MergeEachIndividualFolder</WDPMergeOption>。
对于发布管道,我使用的是 IIS Web 部署。
为了构建管道代理规范,我使用的是 vs2017-win2016
对于构建解决方案任务,我使用的是最新版本的视觉 stidio
我尝试过的事情:
1.将配置参数传递给 msbuild,用于 azure 构建管道中的构建解决方案任务:
/p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory) /p:OutputPath=bin
/p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:PrecompileBeforePublish=true
/p:EnableUpdateable=false /p:DebugSymbols=true /p:UseMerge=true /p:DeleteAppCodeCompiledFiles=True
/p:DeleteExistingFiles=True /p:WDPMergeOption=MergeEachIndividualFolder /p:UseFixedNames=true\\"
2。上传 FolderProfile.pubxml ,并将参数传递给 msbuild 以从该文件中读取
所有构建和发布都很好,但不会在发布中合并程序集,因为配置了合并选项,msbuild 似乎忽略了这些额外的合并参数。
如何做到这一点,主要问题是在使用 azure 管道部署时如何使用MergeEachIndividualFolder 选项?
我也搜索了很多,但似乎没有一个问题涵盖解决方案。
Azure DevOps Build - publish doesn't create .compiled files in bin folder on publish
【问题讨论】:
-
你试过
/p:DeployOnBuild=true /p:PublishProfile=xxxx参数吗? -
@CeceDong-MSFT 如果
xxx指的是FolderProfile.pubxml的路径,是的,我已经尝试过了 -
xxxx表示配置文件名称:/p:DeployOnBuild=true /p:PublishProfile=FolderProfile -
您的问题进展如何?论证有效吗?
标签: asp.net visual-studio azure-devops msbuild azure-pipelines