0

We have a solution with many Class Library projects. These produce a set of DLLs each.

The way we want to deploy these is to install them to the GAC. So we can have a script (BAT file) to run Gacutil /i on the DLL.

We currently use TFS to build our solution using the default TFS build template.

We need TFS to build the solution, and produce folders for each project (the release package) with the DLL and install script. So all we need to do after that is go to the drop folder, see a list of folders (release packages), and everything we need to install each class library in within the folder.

e.g.

-> Dropfolder
  -> Proj1
     -> Proj1.dll
     -> Install.bat
  -> Proj2
     -> Proj2.dll
     -> Install.bat
  -> Proj3
     -> Proj3.dll
     -> Install.bat

Update:

For each project I have set up the following Post-Build event:

powershell -executionpolicy Bypass -file "$(ProjectDir)Deployment\CreateDeploymentPackage.ps1" -Bin $(TargetDir) -Source $(ProjectDir) -Name $(ProjectName)

In my source I have the said powershell script Deployment\CreateDeploymentPackage.ps1

The powershell scripts looks something like this:

param(
[string][parameter(mandatory=$true )] $Bin,
[string][parameter(mandatory=$true )] $Source,
[string][parameter(mandatory=$true )] $Name)

$packagePath = "$Bin$Name"
New-Item "$packagePath" -type directory

Copy-Item *.dll $packagePath -recurse

Copy-Item "$deploymentScripts\Install.ps1" "$packagePath" -recurse
Copy-Item "$deploymentScripts\Uninstall.ps1" "$packagePath" -recurse

Now this works when I build locally. It picks up all dlls in the bin directory and copies them into the folder.

This also works on the TFS build server, but only when building the project by itself.

The problem lies in how TFS builds all the dlls in my solution into a single bin output directory.

Question

Is there a way to copy only the dlls that are related to the project (including dependencies) without explicitly listing each dll?

EdmundYeung99
  • 2,461
  • 4
  • 27
  • 43

1 Answers1

1
  1. Is doesn't matter in the slightest, you can setup your source control what ever best suits you needs.

  2. Have a read of this MSDN Article that explains how to control where TFS places your assemblies. For your install.bat files you can check them into TFS and use a post build step to copy them with your output. If you really wanted you might be able to create a custom TFS Activity to generate them as part of the build - have a read of this Blog Series by Ewald Hofman, to get your head around customising TFS builds.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • does the default build template have hooks like the post build event to avoid having to put post build events in all projects, and to avoid using a custom build template? – EdmundYeung99 Nov 07 '12 at 22:56
  • @EdmundYeung99 - no sorry, those are your 2 choices. Customising the build process isn't as scary as it sounds. I also got a copy of Wrox's TFS 2010 book to help me. – DaveShaw Nov 07 '12 at 23:30
  • I agree that its not difficult, but it gets complex to manage many build templates customized for different project types, and then there is no guarantees they will work when upgrading to the next version of TFS. I'll look into the links you've provided – EdmundYeung99 Nov 08 '12 at 00:25
  • The TFS 2010 book from Wrox covers how to setup shared process templates. And 2010 templates are supported in 2012. – DaveShaw Nov 08 '12 at 08:21