我在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'.
答案 0 :(得分:1)
在你的硬盘中搜索&#34; MSDeploy.exe&#34; ....并查看你有多少个不同的版本。
然后尝试设置&#34; ToolPath&#34;
<MSDeploy
ToolPath="C:\OneOfTheFoldersWithMsDeployExeInIt"
Verb="sync"
Source="@(DeploySource)"
Destination="@(DeployDestination)"
AllowUntrusted="true"
/>