4

I'm trying to deploy a package via the MSDeploy task from within MSBuild.

I have configured two Item Groups to represent my source and destination.

The source is a package I have created eg. Solution.zip The destination is IIS 7 on a remote server.

The configuration looks like this :

<ItemGroup>
    <DeploySource Include="package">
        <Path>$(PackagePath)</Path>
    </DeploySource>
</ItemGroup>

<ItemGroup>
    <DeployDestination Include="iisApp">
        <ComputerName>https://myserver.com/msdeploy.axd</ComputerName>
        <UserName>XXXXXXXX</UserName>
        <Password>XXXXXXXX</Password>
        <AuthType>Basic</AuthType>
        <Path>Default Web Site/Umbraco.Web_deploy</Path>
    </DeployDestination>
</ItemGroup>
<PropertyGroup>
    <ConfigFileName>Staging.config</ConfigFileName>
</PropertyGroup>

I then call the MSDeploy task within MSBuild like this :

<Target Name="Deploy_v2">
    <!-- Using ContinueOnError due to a bug in MSDeploy task-->
    <MSDeploy
        ContinueOnError="true" 
        ToolPath="C:\Program Files\IIS\Microsoft Web Deploy V3"
        Verb="sync"
        Source="@(DeploySource)"
        Destination="@(DeployDestination)" 
        AllowUntrusted="true"
        Replace="objectName=filepath,match=Configs\$(ConfigFileName),replace=web.config"
    />
</Target>

This results in the following command line execution

C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe -source:package='C:\CLIENTS\DAM\Components\Umbraco\SiteTemplate_v6_1_6\Output\Package\UmbracoTemplate_v6_1_6.zip' -dest:iisApp='Default WebSite/Umbraco.Web_deploy',ComputerName='https://myserver.com/msdeploy.axd',UserName='XXXXXXX',Password='XXXXXXXX',AuthType='Basic' -verb:sync -replace:objectName=filepath,match=Configs\Staging.config,replace=web.config -allowUntrusted

Which unfortunately results in the following error :

MSDEPLOY : Error: Source (dirPath) and destination (iisApp) are not compatible for the given operation.

It seems to me that MSDeploy is viewing my package as a dirPath. When I created the package it did use a dirPath as its source.

1 Answer 1

0

As the error states dirPath and iisApp are not compatible providers, although iisApp does use dirPath. See here

iisApp can take a directory as the source so try packaging the target directory via iisApp as follows:

msdeploy -verb:sync -source:iisApp=c:\inetpub\wwwroot -dest:package=Package.zip

Btw if you are using Visual Studio you can generate an MSDeploy package using MSBuild with /t:Publish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.