Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I avoid this deep folder structure with MSDeploy to filesystem using MSBuild?

I'm pulling my hair out over this MSBuild issue.

We're using TeamCity to build a solution with two MVC websites in it. As part of the build we're deploying to a folder on the build server. IIS points to this folder to give us an integration build visible to management.

Here's the code from the MSBuild file that uses MSDeploy to publish a package - but not as a zip file.

<Target Name="Deploy">   <MSBuild      Projects="$(SolutionFile)"     Properties="Platform=$(Platform);Configuration=$(Configuration);     DeployOnBuild=true;     DeployTarget=Package;     PackageLocation=$(PackageLocation);     PackageAsSingleFile=False;     AutoParameterizationWebConfigConnectionStrings=False" /> </Target> 

The problem here is that we get an incredibly deep folder structure. Here's an example...

C:\DEPLOY\Archive\Content\C_C\Users\Edmond\Documents\Visual Studio 2008\CreatioGreen\Creatio\Code\core\trunk\Website\Website\obj\Release\Package\PackageTmp[published files]

I really want to deploy to predictable folders like...

C:\build\website[published files] C:\build\mobilewebsite[published files]

That's the background. Here are the specific questions.

  1. Are we making a mistake trying to use MSDeploy to publish to a local filesystem? We basically need the equivalent of the VS2010 "publish" feature, with config transforms. We're not trying to deploy to remote IIS instances or anything.

  2. Is there any way of doing this but specifying the publish folders?

  3. I've been trying to use the MSBuild Copy task to copy the files into more sensible folders - but I can't work out how to use wildcards to specify the folders we need to take - it would need to be something like...

C:\FolderPackageEndsUpIn[ANYFOLDERS]\Website[ANYFOLDERS]\PackageTmp**.

Help!

like image 998
centralscru Avatar asked Nov 16 '10 11:11

centralscru


1 Answers

If you add the _PackageTempDir parameter to MSBuild it will give you the same results as doing a local publish. e.g.

msbuild C:\PathToMyProj.csproj /p:Configuration=UAT;DeployOnBuild=true;PackageAsSingleFile=False;DeployTarget=Package;_PackageTempDir=c:\PathToMyDeploy\;AutoParameterizationWebConfigConnectionStrings=false

This command will publish all my files to c:\PathToMyDeploy\ without the crazy subfolders

like image 132
Ciaran O'Neill Avatar answered Sep 17 '22 20:09

Ciaran O'Neill