从VS2010使用WebDeploy在Web服务器上执行CMD
问题描述:
我想在VS2010的部署操作之前和之后在Web服务器上执行一些批处理文件(我可以控制它的IIS)。从VS2010使用WebDeploy在Web服务器上执行CMD
我已经添加了我的服务器的IIS中的“runCommand”供应商,并添加以下代码到的.csproj文件:
<Target Name="AddingCMDtoManifest">
<Message Text="Adding CMD to Manifest" />
<ItemGroup>
<MsDeploySourceManifest Include="runCommand">
<path>C:\blahblah.bat</path>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
但似乎没有任何改变,我缺少什么?
答
也许你需要在正确的阶段执行你的目标。我做了以下事情,它的工作原理。
<PropertyGroup >
<RunCommandPath>DeploySettings\NightlyBuild.RunCommand.cmd</RunCommandPath>
</PropertyGroup>
<Target Name="SetupCustomManifestProviders" BeforeTargets="AddContentPathToSourceManifest">
<ItemGroup>
<MsDeploySourceManifest Include="runCommand">
<Path>$(RunCommandPath)</Path>
<dontUseCommandExe>true</dontUseCommandExe>
<waitInterval>10000</waitInterval>
<AdditionalProviderSettings>dontUseCommandExe;waitInterval</AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemGroup>
</Target>