TFS 2017 - how build/deliver only changed files?

不打扰是莪最后的温柔 提交于 2019-11-28 09:43:52

问题


I'm using TFS 2017, and regarding to title I found a term: Incremental build - but, I can not find out where to set it. I tried to add Incremental parameter in ' build parameters' (/p:IncrementalBuild=true) but always got error which says that this is wrong parameter. Is possible to deliver (or build and deliver) only changed files?


回答1:


If you want to have an incremental build. When you add a Visual Studio Build / MSBuild task to build the project, just uncheck the Clean option. Thus it will sync the source and only get the changed files from the second time to build. See Build task Arguments for details.

Clean Option : Set to False if you want to make this an incremental build. This setting might reduce your build time, especially if your codebase is large. This option has no practical effect unless you also set Clean repository to False.

Set to True if you want to rebuild all the code in the code projects. This is equivalent to the MSBuild /target:clean argument.

Assuming you want to deliver the only changed files to a specific location, you can add a Copy Files step to copy the changed files to the location.




回答2:


Lets assume how I solved this problem (if anyone has similar problem):

Since TFS 2017 always delivered all files - changed and unchanged, but I need only changed, I solved this as follows:

Since files that are transferred to Artifact keep timestamp (unchanged files have last_edited timestamp, and edited files have new, current timestamp) I decide to create FIXED Artifact directory (not depending on build version, but always the same). Then I wrote PowerShell script (as a first Release step ) which deletes all files (recursive) which have timestamp that is < (Now - x min), and all empty directories after that. On this way Artifact directory contains of ONLY CHANGED files (entire file structure (of changed files) is kept). Now Release will deliver only these files to destination.

Cheers! :)



来源:https://stackoverflow.com/questions/45615690/tfs-2017-how-build-deliver-only-changed-files

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