简体   繁体   English

发布事件后复制文件

[英]Copy Files after Publish events

I'm trying to copy reports with a "batch script" through MSBuild. 我正在尝试通过MSBuild复制带有“批处理脚本”的报告。 I currently have a project that is targeting v3.5 in Visual Studio 2012. 我目前有一个针对Visual Studio 2012中的v3.5的项目。

I modified my website.publishproj and added: 我修改了website.publishproj并添加了:

<Target Name="MyTarget" AfterTargets="CopyAllFilesToSingleFolderForPackage" >
    <Exec Command="echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Copying Reports @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" />
    <Exec Command="xcopy.exe $(MSBuildProjectDirectory)\..\MoteurRapports $(PublishURL)\Rapports\ /S /E /H /EXCLUDE:$(MSBuildProjectDirectory)\CopyRapportExclude.txt" />
</Target>

But when I publish it: 但是当我发布它时:

254 files(s) copied
**Deleting existing files...**
Publishing folder /...
Publishing folder AideHTML...

It deletes the files I just copied. 它会删除我刚刚复制的文件。 Is there a target after the deletion that I can use with the publish wizard? 删除后可以与发布向导一起使用的目标吗?

I believe you may need to add this argument to your msbuild cmd. 我相信您可能需要将此参数添加到您的msbuild cmd中。 That will keep it from "cleaning" any files it believes are not part of the deployment. 这样可以防止它“清除”它认为不属于部署的任何文件。

/p:SkipExtraFilesOnServer=True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM