MSDEPLOY :Unable to cast object of type 'Microsoft.Web.Deployment.DeploymentProviderOptions' to same type error

StackOverflow https://stackoverflow.com/questions/19593511

  •  01-07-2022
  •  | 
  •  

Question

I have an MSDEPLOY task within an MSBuild script which i am trying to use to deploy to a remote server.

<Target Name="Deploy_v2">
    <ItemGroup>
        <DeploySource Include="package">
            <Path>$(PackagePath)</Path>
        </DeploySource>
        <DeployDestination Include="auto">
            <ComputerName>https://C3PO:8172/msdeploy.axd</ComputerName>
            <UserName>C3PO\developer</UserName>
            <Password>Password123</Password>
            <AuthType>Basic</AuthType>
        </DeployDestination>
    </ItemGroup>
    <Message Text="About to deploy!!" />
    <MSDeploy
        Verb="sync"
        Source="@(DeploySource)"
        Destination="@(DeployDestination)" 
        AllowUntrusted="true"
    />
    </Target>

When I try to run this I get a very strange message as shown below :

MSDEPLOY : error : Unable to cast object of type 'Microsoft.Web.Deployment.DeploymentProviderOptions' to type 'Microsoft.Web.Deployment.Deployme
ntProviderOptions'.
Was it helpful?

Solution

Search your harddrive for "MSDeploy.exe"....and see how many different versions you have.

Then experiment with setting the "ToolPath"

<MSDeploy
    ToolPath="C:\OneOfTheFoldersWithMsDeployExeInIt" 
    Verb="sync"
    Source="@(DeploySource)"
    Destination="@(DeployDestination)" 
    AllowUntrusted="true"
/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top