I have one solution with four web site projects in it. I am looking for possibility to publish these 4 websites to separate folders with different names. I call MsBuild command line from TFS. Another point is that I need to dynamically pass in WebProjectOutputDir so with every build in TFS websites will be published to different location.
3 Answers
If you have a FileSystem publish profile, you can set the publishUrl property to the filesystem path you want to publish to
msbuild ..\something.sln /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=Filesystem /p:publishUrl=$publishPath

- 16,738
- 8
- 39
- 36
You can look at using Web Deploy. Web Deploy helps you in publishing websites. You create a Web Deploy package on build and then use Web Deploy to actually deploy the website to a target server. This can all be integrated with MSBuild.
In essence it comes down to specifying DeployOnBuild=true
as a parameter for your MSBuild. By then using publishing settings, you can create different configurations that you can use to publish your website to.

- 39,090
- 12
- 84
- 103
-
Thank you for fast answer, but I already know that. Main problem is that I have to dynamically set output directory and call MsBuild from cmd. – RobinGoth Jul 31 '14 at 15:32
You should be able to use solution to similar question: How to parametrize DeployIisAppPath Msbuild argument in Tfs Build. The only difference in your case would be that you will want to modify property WebProjectOutputDir
, rather than DeployIisAppPath
.
If you also want to make the paths different with every build, so that new builds do not override old builds, you will have to embed build number or timestamp to the paths.

- 1
- 1

- 11,720
- 2
- 35
- 54