Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't msdeploy web package to temporary folder?

We've got an Asp.Net web application we're trying to get pseudo-deployed to a folder, and I'm starting to think Microsoft are crazy -- why is it so hard to get a WAP to do a "Local FileSystem" deploy as part of MSBuild?

I can build with this:

msbuild .\SubSite.csproj "/p:Platform=AnyCPU;Configuration=Release" /t:Package

And get a nice package.zip which I can deploy to a website...

However, I have two projects in my solution, which I need to combine before I ship them, so I want to deploy both packages into a folder, and then re-package that folder. Despite the documentation on technet to the contrary, it doesn't seem to be possible to do:

msdeploy -verb:sync -source:package=.\SubSite.zip -dest:contentPath=.\Www\SubSite

Because you get the error:

Source (sitemanifest) and destination (contentPath) are not compatible for the given operation.

Does anyone have a suggestion of how I could web deploy two sites inside one another without manually copying files out of a "PackageTmp" folder? I mean, I'm aware that I could just skip zipping the package and manually copy the files out to do this, but I'm not happy about having to create a custom target, and there's no other way to find that just to do something that should be built in.

like image 820
Jaykul Avatar asked Feb 26 '12 03:02

Jaykul


1 Answers

We did eventually figure out how to do this, but I'm not really happy about it ;-)

Basically, (as mentioned elsewhere on so), you can call msbuild with the target set to _WPPCopyWebApplication. You can also specify/override the WebProjectOutputDir property when you do that. Something like this (where ${name} are variables we're using)

msbuild ${SourcePath}\Www\UI\UI.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot" "/t:_WPPCopyWebApplication"
msbuild ${SourcePath}\Www\Mobile\Mobile.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot\Mobile" "/t:_WPPCopyWebApplication"
msbuild ${SourcePath}\Www\Service\WebService.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot\WebServices" "/t:_WPPCopyWebApplication"

We can then package up the whole "AppRoot" in a separate step.

like image 89
Jaykul Avatar answered Oct 20 '22 02:10

Jaykul