MSDEPLOY:无法将类型为“Microsoft.Web.Deployment.DeploymentProviderOptions”的对象转换为相同的类型错误

时间:2013-10-25 15:10:59

标签: msbuild msdeploy webdeploy

我在MSBuild脚本中有一个MSDEPLOY任务,我试图用它来部署到远程服务器。

<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>

当我尝试运行时,我收到一条非常奇怪的消息,如下所示:

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

1 个答案:

答案 0 :(得分:1)

在你的硬盘中搜索&#34; MSDeploy.exe&#34; ....并查看你有多少个不同的版本。

然后尝试设置&#34; ToolPath&#34;

<MSDeploy
    ToolPath="C:\OneOfTheFoldersWithMsDeployExeInIt" 
    Verb="sync"
    Source="@(DeploySource)"
    Destination="@(DeployDestination)" 
    AllowUntrusted="true"
/>