Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 让Web Deploy在发布后运行批处理文件_Visual Studio_Publish_Msdeploy_Webdeploy - Fatal编程技术网

Visual studio 让Web Deploy在发布后运行批处理文件

Visual studio 让Web Deploy在发布后运行批处理文件,visual-studio,publish,msdeploy,webdeploy,Visual Studio,Publish,Msdeploy,Webdeploy,我正在使用Web部署将Web应用程序从Visual Studio 2012发布到目标IIS服务器。一切都很好 我现在想要部署到一个web场(在一个工作组内)中的多个服务器。我已经生成了一个Robocopy脚本,一旦文件部署到第一个web服务器上,就可以通过网络将其复制到其他主机。我可以手动运行这个bat文件,没有问题,但是我想在部署过程中自动运行它 到目前为止,我已经在VS项目中编辑了.pubxml文件,如下所示 <ItemGroup> <MsDeploySourc

我正在使用Web部署将Web应用程序从Visual Studio 2012发布到目标IIS服务器。一切都很好

我现在想要部署到一个web场(在一个工作组内)中的多个服务器。我已经生成了一个Robocopy脚本,一旦文件部署到第一个web服务器上,就可以通过网络将其复制到其他主机。我可以手动运行这个bat文件,没有问题,但是我想在部署过程中自动运行它

到目前为止,我已经在VS项目中编辑了
.pubxml
文件,如下所示

  <ItemGroup>
    <MsDeploySourceManifest Include="runCommand">
      <Path>robocopy &quot;c:\web1&quot; &quot;\\REMOTEMACHINE\web1&quot; /MIR</Path>
    </MsDeploySourceManifest>
  </ItemGroup>

机器人复制“c:\web1”“\\REMOTEMACHINE\web1”/MIR
这将在同步所有文件之前运行“确定”命令。根据发布日志,它运行了两次。在文件同步过程中间。


如何调整
.pubxml
文件,使其仅在同步所有文件后运行该命令?

我相信我已通过将
项目组
包装在
目标
中解决了这一问题
postertargets
设置为
addissettingandfilecontentstosourcemanifest

我仍然不知道为什么命令会被执行两次?我欢迎任何关于如何简化此操作的其他建议

  <Target Name="RoboCopyToHosts" AfterTargets="AddIisSettingAndFileContentsToSourceManifest">
    <ItemGroup>
      <MsDeploySourceManifest Include="runCommand">
         ....
         ....
      </MsDeploySourceManifest>
    </ItemGroup>
  </Target>

....
....