27 September 2010

<OutputPath> in Web Deployment Project 2010

I use a build server and Web Deployment Project 2010 to deploy my build to the web server and recently updated… Another version, another problem. This time <OutputPath> doesn’t  work if you enter an absolute path. Quite why MS decided you must have only relative paths is beyond me but it throws out an error like:

C:\Program Files\MSBuild\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.targets(288, 5): error MSB4184: The expression "[System.IO.Path]::GetFullPath(C:\TeamCity\buildAgent\work\dc097bd7ad70eb41\trunk\[WebDeploymentProjectFolderName]\[deployment path e.g. E:\ftproot\[App name]\)" cannot be evaluated. The given path's format is not supported.

For now I’ve overcome it by simply entering a large number of ..\ in the path that correspond to the location but I’m far from satisfied. I want to be able to choose to have the path on another drive for example! I think I’ll be implementing a solution using ‘AfterBuild’ (as per this answer on stackoverflow.com) although it annoys me that I can’t do it in the ‘normal’ place!


<Target Name="AfterBuild">
    <Exec Command="xcopy /Y /S /F /R $(TargetPath) $(CentralisedBinariesFolderLocation)" />

Which will copy it to the relevant location after the build.

No comments:

Post a Comment