我正在设置 持续集成和持续交付 基础设施,我的解决方案包含 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\1\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
任务来构建其余的应用程序。引用这个类似的线程:TFS 2015 CI - Build artifacts are not generating for Console application in the solution which has web, console and WCF projects更新:
您可以简单地将它们复制到网站。尝试使用 Windows Machine File Copy要做到这一点,您也可以编写自己的脚本来做到这一点。
关于TFS 2018 构建控制台应用程序未包含在构建工件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50468925/