We're using MSDeploy with a Web Deployment Project to deploy our web site project using TFS Builds (TFS 2010 and VS 2010).
TFS Build sends the built files to a sub-folder of the specified drop folder, so if I specify the drop folder as:
\\machineName\Builds
The build project is dropped into:
\\machineName\Builds\1. Test\20120226.38\Deploy
In that example, "1. Test" is the name of the TFS Build definition, "20120226.38" is a date-stamp and build number, and "Deploy" is the name of the Web Deployment Project.
When I create my DeploySource itemgroup in the Deploy.wdproj file, and specify the exact path for the MSDeploy source (see directly below) everything's fine. Example:
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' "> <DeploySource Include="DirPath"> <Path>C:\Builds\1. Test\20120226.39\_PublishedWebsites\Deploy</Path> <ComputerName>machineName</ComputerName> <UserName>$(UserName)</UserName> <Password>$(Password)</Password> </DeploySource> </ItemGroup>
To account for a changing build number and date, I've added a $(BuildNumber) variable via the DefaultTemplate.xaml file. So, here's the subtly changed example:
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' "> <DeploySource Include="DirPath"> <Path>C:\Builds\1. Test\$(BuildNumber)\_PublishedWebsites\Deploy</Path> <ComputerName>machineName</ComputerName> <UserName>$(UserName)</UserName> <Password>$(Password)</Password> </DeploySource> </ItemGroup>
And they're passed into this MSDeploy call:
<MSDeploy Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' " Whatif="$(WhatIf)" Verb="sync" Source="@(DeploySource)" Destination="@(DeployDest0)" ExePath="$(MSDeployPath)" />
Here's my problem:
With example 1 above, everything's fine, and the build site deploys to the correct location.
With example 2 above, I get the following error:
MSDEPLOY: Object of type 'dirPath' and path '\\machineName\Builds\1. Test\20120227.2\_PublishedWebsites\Deploy' cannot be created. MSDEPLOY: (2/27/2012 6:54:14 PM) An error occurred when the request was processed on the remote computer. MSDEPLOY: Object of type 'dirPath' and path '\\machineName\Builds\1. Test\20120227.2\_PublishedWebsites\Deploy' cannot be created. MSDEPLOY: Could not find directory '\\machineName\Builds\1. Test\20120227.2\_PublishedWebsites\Deploy'. MSDEPLOY: Could not find a part of the path '\\?\UNC\machineName\Builds\1. Test\20120227.2\_PublishedWebsites\Deploy'.
Checking out and manually changing the build number isn't a realistic option. I feel like there's something simple I'm missing here, but I can't put my finger on it.
Note: This is a web site project, not a web application project. Time constraints and black-box vendor dependencies won't allow a conversion.