How to run Visual Studio post-build events for deb

2019-01-03 07:21发布

How can I limit my post-build events to running only for one type of build? I'm using the events to copy DLLs to a local IIS virtual directory but I don't want this happening on the build server in release mode.

9条回答
霸刀☆藐视天下
2楼-- · 2019-01-03 08:13

Visual studio 2015: The correct syntax is (keep it on one line):

if "$(ConfigurationName)"=="My Debug CFG" ( xcopy "$(TargetDir)test1.tmp" "$(TargetDir)test.xml" /y) else ( xcopy "$(TargetDir)test2.tmp" "$(TargetDir)test.xml" /y)

No error 255 here.

查看更多
Summer. ? 凉城
3楼-- · 2019-01-03 08:13

This works for me in Visual Studio 2015.
I copy all dll-files from a folder located in a lib folder on the same level as my solution folder into the targetdirectory of the project being built.
Using a relative path from my project directory and going up the folder structure two steps with..\..\lib

MySolutionFolder
....MyProject
Lib

if $(ConfigurationName) == Debug (
xcopy /Y "$(ProjectDir)..\..\lib\*.dll" "$(TargetDir)"
) ELSE  (echo "Not Debug mode, no file copy from lib")
查看更多
淡お忘
4楼-- · 2019-01-03 08:13

Like any project setting the buildevents can be configured per Configuration, just select the configuration you want to change in the dropdown of the Property Pages dialog and edit the post build step

查看更多
登录 后发表回答