简体   繁体   English

将bin文件复制到VS2010中Post Build事件的Physical文件位置

[英]Copy bin files on to Physical file location on Post Build event in VS2010

I want to copy my dll generated in bin folder to a file location on Post Build Event in vs2010. 我想将bin文件夹中生成的dll复制到vs2010中Post Build Event上的文件位置。

Can some one help me on that. 有人可以帮助我。

Thanks 谢谢

You want to add something like: 你想要添加如下内容:

xcopy /Q /Y "$(TargetPath)" "C:\path\to\somewhere\"

to you post-build event on the Build Events tab in the project properties page. 在项目属性页面的Build Events选项卡上的post-build事件。 The /Y will stop it from prompting you to confirm an overwrite. /Y将阻止它提示您确认覆盖。

If you also need to copy the .pdb file, you will need something like this: 如果您还需要复制.pdb文件,则需要以下内容:

xcopy /Q /Y "$(TargetDir)$(TargetName).*" "C:\path\to\somewhere\"

You can see more substitution tokens (the $XXX values) by clicking the Edit Post-build... button in the properties tab and then expanding the Macros>> button. 通过单击属性选项卡中的编辑后构建...按钮,然后展开宏>>按钮,可以看到更多替换令牌($ XXX值)。

Right-click the project, then go to Properties->Build Events->Post-build command line. 右键单击该项目,然后转到“属性” - >“构建事件” - >“构建后”命令行。

Then type this in: 然后输入:

Cmd /C Copy "$(TargetPath)" "<YourTargetDirHere>"

Does that help? 这有帮助吗?

We use the following post build event for copying plugin dlls to the web application's plugin directory: 我们使用以下post build事件将插件dll复制到Web应用程序的插件目录:

copy $(TargetPath) $(SolutionDir)Convergence.WebApp\\home\\plugins\\$(TargetFileName) copy $(TargetPath)$(SolutionDir)Convergence.WebApp \\ home \\ plugins \\ $(TargetFileName)

This works across multiple machines where the physical path may be different, but relies upon the destination being relative to the $(SolutionDir). 这适用于物理路径可能不同的多台机器,但依赖于相对于$(SolutionDir)的目标。

对于那些想要从Output文件夹中复制所有内容的人

xcopy "$(TargetDir)*" "C:\testpublish\updater\"  /s /Y

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

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