Building Project in VSTS doesn't build all projects in solution

Deadly 提交于 2020-01-01 06:10:10

问题


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?


回答1:


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 "**\bin\$(BuildConfiguration)**" folder to "$(build.artifactstagingdirectory)" folder and then publish the files in "$(build.artifactstagingdirectory)" folder. But this is not applicable to Web App Project.

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)\\"

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




回答2:


I also had this issue (or similar?) The artifacts for the main project were not published, only the test project.

When looking in the log file i noticed two things.

  1. Only files from the Test project were copied

  2. The task "Copy Files to:$(build.artifactstagingdirectory)" was looking for contents using the wildcard "\bin\release**" this path is set in the build step "Copy Files" / "Content" and is "\bin\$(BuildConfiguration)**" by default, translating to your setting in "Variables" / "BuildConfiguration" under this build definition.

Then I looked at the project settings in Visual Studio and for some reason the main project had the setting in "Build / Output / Output path" set to "bin\"; changing this to "bin\Release" for Release and "bin\Debug" for debug solved my problem.

Solution?

a. Set VS project setting "Build / Output / Output path" to "bin\Release"

b. (or change VSTS build step "Copy Files" / "Content" to "\bin" to catch everything in bin)



来源:https://stackoverflow.com/questions/38087636/building-project-in-vsts-doesnt-build-all-projects-in-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!