Deploy only changed files in TFS deployment 2012 - visual-studio

I am working on TFS 2012 Builds. I have created a build template to deploy Asp.net application and its working properly but its deploying full build every time.
I need to deploy
1. Only changed files
2. I don't wanna deploy folders like 'Uploads or Attachments etc'
3. I don't want to deploy Web.config file
I have searched for MSbuild arguments but didn't get result , also SkipUnchangedFiles didn't work in 2012 TFS.
Can you guys help me achieve these result.
Thanks

First, you can set Clean Workspace to None in the build definition. This will speed up the build times by only building what has changed. In this way, your output dir will contain all of the old and new files.
Then you can override the AfterCompile target to delete any file whose timestamp is older than (current time - 1hr). After the delete operation, your out dir folder will only contain the new files. The Build will then copy those files out to the Drop folder. Now your drop folder will have the files you need to deploy.
Check: https://social.msdn.microsoft.com/Forums/vstudio/en-US/32a4f153-846f-4acb-bcca-018d6143a50a/build-tfs-build-only-what-is-changed?forum=tfsbuild

Related

Parameters.xml - what is the best way to include many of them?

We have a couple of environments where we want to deploy our webapp to. We would like to include a range of setparameters.xml files in our project and when we execute the web publishing pipeline (wpp) we want those be copied over to the destionation folder. What would be the additions we need to include in wpp.targets?
We are using Visual Studio 2013 / 2015.
No changes are required in the wpp.targets file. We have 4-7 different SetParameters.[env].xml files for most of our products. We keep this in the root of the web application project.
We use the -setParamFile flag to set the necessary parameter file for the right environment when we execute the *.deploy.cmd file. We use Thoughtworks GO! to trigger the deployment but you can use any release orchestration product or just the commandline.

How to publish App_Data folder to IIS 8 using MsBuild?

I am using a TeamCity build that has been working for the past several years on IIS 7.5 installations. I have recently upgraded to IIS 8 and I am finding that the App_Data directory is not being deployed when I execute my MsBuild script.
Our TeamCity build deletes the entire IIS site directory contents during each publish to ensure that we start with a clean slate and don't have an lingering files. I need to continue to do this but now all of the sudden I can longer automatically push out the App_Data folder during the publish step. I have even tried adding a dummy Placeholder.txt file to the folder (and set the BuildAction to content in Visual Studio) but the App_Data folder still does not appear on my web server. Any help would be greatly appreciated.
So... it turns out that all I had to do was add some content to the Placeholder.txt files. Seems like the deployment tools were skipping the files since they were empty.

Problems Building a WCF Project with TFS 2010

I have a WCF project with a single .svc file and some .config files in it. I'm trying to create a build definition in TFS 2010 that will copy these files to an IIS folder on another machine.
I've done similar things with other MVC projects using the CopyDirectory task in the build XAML template. In those, I copy from the _PublishedWebsites folder to the IIS folder. However, with the WCF project, there is no _PublishedWebsites folder.
So I tried updating the MSBuild script for the WCF project to create a _PublishedWebsites folder and copy the files to it. This works when I build locally in Visual Studio 2010. But when it runs on the TFS build server, it doesn't quite work.
What I see there is that in "C:\Builds\1\PROJECT\PROJECT (Continuous Build)\Sources\PROJECT\bin\_PublishedWebsites", I can see all the files.
I'm guessing this "1 folder" is a temporary folder used for building...? I'm not sure what it's used for. But when I look at the actual drop location for the build, in "C:\Builds\PROJECT (Continuous Build)\PROJECT_BUILDNUMBER\", I see nothing except log files. None of the files from the "1 folder" are there.
Note that this same solution also has a WiX project to create a deployment package. That seems to build fine, and shows up in the drop location with no issue.
"1 folder" is a temporary folder used for building
Yes. "1" is number of build agent(service that actually executes builds activities) on your build machine.
But when I look at the actual drop location for the build, in "C:\Builds\PROJECT (Continuous Build)\PROJECT_BUILDNUMBER\", I see nothing except log files.
- Usually "Copy Files To Drop Location" flag is responsible for that.

Programmatically update files in a tfs workspace

I am working on an extension for visual studio to update a project.
The situation is a follows:
We create a new project from a template.
We put the solution in tfs
We change the project which was used to create the template. The project on the tfs server still needs te be updated.
We publish the project to a folder. I now want to update the files in the TFS repo with the current files in the publish folder
I thought of the following approach:
In the application we have all the project stored that are on the TFS server. When I want to update a specific project I select the project from the database. Next I load this project from the TFS server and create a new checkout for this project. So far so good. The problem arise when I copy the files from the published folder to the new checkout. Files that are already registered in the workspace get marked as changed but the files that are new are not added.
The only solution I can think of is to add all the files through the TFS SDK. But this seems pretty heavy to me.
So I got a couple of questions:
Is this the right approach to update
the project?
Is there any other way to add the files to the workspace instead of adding all files through the TFS SDK?
Thanks!
Don't do a blind copy of the files. Instead, have your program iterate through them one by one.
First, update your workspace with the latest from TFS.
Then, for each file in the source directory:
If the file exists in the target directory, "pend edit" the file, then copy it.
If the file does not exist, copy the file, then "pend add" the file.
When you've finished, check in all pending changes in the workspace.

Make visual studio deploy a folder's content without having to update it in the project

In my web project I often have a number of files in my app_data folder. These files can vary from time to time (example translation files get a new language, lucene index gets updated and gets a new file name etc).
Visual studio only adds files to the deployment process if the files are seperately added to the project. So if a file has been added on disk, but not in the project, this file will not be copied to the server...
Is there a way to make VS add all files in a folder to the deployment process without me having to update it manually?
You can use a post build event to copy the contents of a folder to the build target.
This should get you started:
http://visualstudiohacks.com/general/customize-your-project-build-process/
Wow I just saw this was asked in 2009...I hope you figured this out already :)

Resources