VS2010: Can we have multiple if in post-build event?

后端 未结 2 992
无人共我
无人共我 2021-02-05 07:30

Can we have something like this:

if \"Debug\"==\"$(ConfigurationName)\"
(
  goto :nocopy
)
else if \"Release\"==\"$(ConfigurationName)\"
(
  del \"$(TargetPath).         


        
2条回答
  •  一生所求
    2021-02-05 08:05

    If your post-build logic is getting complicated, I'd suggest moving it to an external file. For example, the following post-build event:

    CALL "$(ProjectDir)PostBuild.cmd" $(ConfigurationName)
    

    executes a batch file PostBuild.cmd in the project-directory, passing $(ConfigurationName) as a parameter. You could also pass other parameters, such as $(TargetPath).

    You can then implement whatever you want including multiple if statements, and more importantly, debug it without running a Visual Studio build.

提交回复
热议问题