如何使用CLI在Azure Devops中构建Web应用程序MVC5-WEB API 2?

我想在Azure中构建一个Web应用程序(Web API 2),但我不想获取一个zip,我只想获取包含所有必需文件的目录。我不知道要执行此操作的命令行。 我不想使用传统的部署Web应用程序任务,因为我需要在构建后添加其他文件。预先感谢您的帮助。

wkao0705120104 回答:如何使用CLI在Azure Devops中构建Web应用程序MVC5-WEB API 2?

  

如何使用CLI在Azure Devops中构建Web应用MVC5-WEB API 2?

您可以将 Visual Studio生成任务与MSBuild参数一起使用:

/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish 

将Web应用发布到工件文件夹或您想要的任何其他文件夹。

您还可以直接指定发布配置文件:

/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="{publish profile name}";publishUrl="$(build.artifactstagingdirectory)"

使用 FileSystem publish 方法,已发布的文件位于文件夹中,而不是压缩文件。

如果要使用命令行任务而不是Visual Studio Build任务,则可以调用具有相同MSBuild参数的MSBuild.exe来构建此解决方案/项目:

"<PathForMSBuild.exeOnYourAgent>\MSBuild.exe" "<YourProject/SolutionPath>" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish

enter image description here

如果要在构建后添加其他文件,可以在Visual Studio生成任务后添加任务,也可以在项目中创建AfterBuild Target来添加其他文件。

希望这会有所帮助。

本文链接:https://www.f2er.com/3109605.html

大家都在问