在 VSTS 中构建项目不会在解决方案中构建所有项目 [英] Building Project in VSTS doesn't build all projects in solution

查看:19
本文介绍了在 VSTS 中构建项目不会在解决方案中构建所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题,当我使用Visual Studio Build"创建构建并提供 *.sln 文件时,它假装构建所有项目(我在日志中看到了这一点),但是在发布工件时解决方案中只有少数项目(主要是测试项目和一些杂项项目,但没有主要项目)我的依赖项排序正常,因为这个构建在 VS2015 中很好(我目前使用 WebDeploy)有人见过这种行为吗?

I'm having a strange issue where when I create a build with "Visual Studio Build" and supply the *.sln file it pretends to build all projects (I see this in the log) but when it comes to publishing artifacts there is only a few of the projects from the solution (mainly test projects and some miscellaneous projects but no the main ones) I have dependencies sorted ok as this build fine in VS2015 (I currently use WebDeploy) Has anyone seen this behavior?

推荐答案

既然你提到了WebDeploy",我怀疑你正在用解决方案中的其他一些项目构建一个 Web 应用项目.您看到的行为通常是由默认的Visual Studio"构建定义模板引起的.使用此模板的默认设置,复制文件"任务将**in$(BuildConfiguration)**"文件夹中的文件复制到$(build.artifactstagingdirectory)"文件夹中,然后发布$(build.artifactstagingdirectory)"文件夹.但这不适用于 Web App 项目.

Since you mentioned "WebDeploy", I suspect that you are building a web app project with some other projects in the solution. The behavior you see is usually caused by the default "Visual Studio" build definition template. With the default settings of this template, the "Copy Files" task copy the files in "**in$(BuildConfiguration)**" folder to "$(build.artifactstagingdirectory)" folder and then publish the files in "$(build.artifactstagingdirectory)" folder. But this is not applicable to Web App Project.

要解决此问题,请在Visual Studio Build"任务的MSBuild Arguments"部分添加以下参数:

To fix this issue, adding following arguments in "MSBuild Arguments" section of "Visual Studio Build" task:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\"

然后你会在 artifacts 中得到一个部署包,你可以通过 web deploy 来部署它.

Then you will get a deployment package in artifacts and you can deploy it via web deploy.

这篇关于在 VSTS 中构建项目不会在解决方案中构建所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆