Is doesn't matter in the slightest, you can setup your source control what ever best suits you needs.
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.
How to script a deployment package for a Class Library with Post-Build events to work on TFS Build
-
27-11-2021 - |
Pergunta
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?
Solução