Visual Studio: Multiple post-build commands?

后端 未结 10 1236
逝去的感伤
逝去的感伤 2020-12-13 16:47

Visual Studio 2008 lets me declare a command and attach it to the post-build event for a project. Like a lot of developers, I use it regularly to xcopy files to the applicat

10条回答
  •  时光取名叫无心
    2020-12-13 17:35

    There is another option: you can separate the commands with &&. E.g.

    copy $(TargetPath) d:\folder1 && copy $(TargetPath) d:\folder2

    This is not exactly the same as separating with newlines: with &&, if the previous command failed, next commant will not run.

    Separating by newlines is easier to read, so you should prefer it. However I know at least one case when && is useful. It is the scenario, when you use property sheets to have different post-build steps on different machines. VS 2008 doesn't allow setting PostBuildStep in property sheets directly, but you can add a user macro with your command and call it from the main project settings. A macro is single line, so you can use && to have multiple commands there.

提交回复
热议问题