2
votes

Have a small ASP.Net Web Application that is setup to build and release via TFS 2017 (Update 2) Continuous Integration and Deployment. It all seems to work well, I check in a code change and the change appears on our test server as expected.

However, when I review the build/release logs it's deploying all the files in my web application project as if they're new files. This includes images and the like that haven't changed.

How can I, a) restrict it to only deploy changed files, or b) only deploy the necessary web application files?

Below are the Build and Release Definitions in TFS, along with the Build and Release logs.

TFS 2017 Build Definition

TFS 2017 Release Definition

2018-03-13T21:46:56.8010920Z ##[section]Starting: Build
2018-03-13T21:46:56.8167174Z Current agent version: '2.117.2'
2018-03-13T21:46:57.5354799Z ##[section]Starting: Initialize Job
...

TFS 2017 Build Log

2018-03-13T07:49:31.8449259Z ##[section]Starting: Release
2018-03-13T07:49:31.8605444Z Current agent version: '2.117.2'
2018-03-13T07:49:32.6262832Z ##[section]Starting: Initialize Job
...

TFS 2017 Release Log

Cheers Phil

1

1 Answers

0
votes

Using the Copy Files task, there is no default match pattern filters could only copy changed files.

For a),you could try to use a powershell script in release definition to achieve your requirement.

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.

More detail info please refer this similar question: TFS 2017 - how build/deliver only changed files?


For b), you could try to use the Build and Deployment template and by default in the MSBuild Arguments the parameter is: /p:OutDir="$(build.binariesdirectory)\\"

enter image description here

Have a look at this question: Build and Deploy a Web Application with TFS 2017 using Web Deploy Package