问题描述
我正在使用Visual Studio Build in Azure Pipeline构建C#应用程序.
I am Building C# Application using Visual Studio Build In Azure Pipeline.
我的解决方案包含多个项目(ManagerWeb和WebAPI).
My solution Contains multiple project (ManagerWeb & WebAPI).
我要发布两个单独的工件管理器Web&分别是WebAPI.
I want to Publish Two Separate Artifact ManagerWeb & WebAPI respectively.
所有必需的文件都在 Build.ArtifactStagingDirectory
中.
All the required File's are present in Build.ArtifactStagingDirectory
.
我如何指定一个模式以获取两个独立的工件?示例1st Artifact&中的 WebAPI
的所有文件名 ManagerWeb
在另一个.
How I can specify a pattern using which I can get Two Separate Artifact ?Example All the File name with WebAPI
in 1st Artifact & ManagerWeb
in another.
ArtifactStaging目录中的文件名如下
The File name from ArtifactStaging Directory are as Below
Something.Manager.WebAPI.deploy.cmd
Something.Manager.WebAPI.deploy-readme.txt
Something.Manager.WebAPI.SetParameters.xml
Something.Manager.WebAPI.SourceManifest.xml
Something.Manager.WebAPI.zip
Something.ManagerWeb.deploy.cmd
Something.ManagerWeb.deploy-readme.txt
Something.ManagerWeb.SetParameters.xml
Something.ManagerWeb.SourceManifest.xml
Something.ManagerWeb.zip
任何帮助都是有意义的.
Any Help will be appreciable.
在此先感谢.
推荐答案
添加PowerShell任务以创建两个文件夹并将文件移动到那里:
Add a PowerShell task to create two folders and move the files to there:
cd $(Build.ArtifactStagingDirectory)
$files = dir
mkdir WebAPI
mkdir ManagerWeb
ForEach($file in $files)
{
if($file.FullName.Contains("WebAPI"))
{
mv $file.FullName -Destination WebAPI
}
else
{
mv $file.FullName -Destination ManagerWeb
}
}
然后在发布路径"字段中添加文件夹:
Then in the "Path to publish" field add the folders:
对于WebApi工件:
For WebApi artifacts:
$(Build.ArtifactStagingDirectory)/WebAPI
对于ManagerWeb工件:
And for ManagerWeb artifacts:
$(Build.ArtifactStagingDirectory)/ManagerWeb
这篇关于如何使用“发布构建工件"任务发布特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!