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

安稳与你 提交于 2019-11-26 22:40:11

问题


I want to copy my dll generated in bin folder to a file location on Post Build Event in vs2010.

Can some one help me on that.

Thanks


回答1:


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. The /Y will stop it from prompting you to confirm an overwrite.

If you also need to copy the .pdb file, you will need something like this:

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.




回答2:


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?




回答3:


We use the following post build event for copying plugin dlls to the web application's plugin directory:

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).




回答4:


For those of you that want to copy everything from the Output folder

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


来源:https://stackoverflow.com/questions/4664386/copy-bin-files-on-to-physical-file-location-on-post-build-event-in-vs2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!