TFS 2018 构建控制台应用程序未包含在构建工件中

TFS 2018 Build Console Application doesn't get included in the build artifact

我正在设置持续集成和持续交付 基础架构,我的解决方案包含 Web 项目、dll 和控制台应用程序。 我的问题是我的所有项目都包含在构建工件中,除了控制台应用程序 这是我使用的默认 MSBuild 参数

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"

生成工件目录中的控制台应用程序的 exe 和发布文件不需要任何项目特定设置。

但是如果你想在工件中包含控制台应用程序,你只需要添加一个复制文件步骤来将控制台应用程序复制到$(build.artifactstagingdirectory)。当然你首先需要确定你已经构建了Console Application工程并且.exe文件生成成功。

Build.ArtifactStagingDirectory

The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\a.

A typical way to use this folder is to publish your build artifacts with the Copy files and Publish build artifacts steps.

或者,您可以使用 MSBuild 任务和 VisualStudioBuild 任务分别构建控制台应用程序来构建其余的应用程序。参考这个类似的线程:


更新:

您只需将它们复制到网站即可。只需尝试使用 Windows Machine File Copy 任务来执行此操作,您也可以编写自己的脚本来执行此操作。