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.
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.
Is there any way of doing this but specifying the publish folders?
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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With