locked
Cannot inherit Post-Build Event using vsprops property sheets. RRS feed

  • Question

  • 1. I'm trying to create vsprops property sheets to manage build configuration settings but am having trouble with the inheriting the Post-Build Event. Let's say I have:

    MyExe.vcproj -> Library1.vsprops

    where -> denotes property sheet inheritance.

    Let's say I set the Post-Build Event's Command Line in Library1.vsprops to

    echo 1

    MyExe.vcproj can pick that up with no problems. However, I can't modify it without losing the inheritance, even by using $(Inherit). For example, if I try setting MyExe.vcproj's Post-Build Event's Command Line to

    $(Inherit)
    echo Final

    , the $(Inherit) doesn't pick up Library1.vsprops' "echo 1", but doesn't generate any errors either.

    2. My eventual goal is to have multiple inherited vsprops and concatenate the Post-Build Events. For example,

    MyExe.vcproj -> Library2.vsprops
                        -> Library1.vsprops

    where each Library*.vsprops does some Post-Build Event of its own, such as copying dependent files to MyExe.vcproj's Output directory. So, if Library2.vsprop's Post-Build Command Line is

    ($Inherit)
    echo 2

    then a successful build should show the following output:

    1
    2
    Final

    where all the Post-Build Command Lines are inherited and executed properly.

    However, if #1 can't be resolved, then #2 probably can't be done either. I suspect this is because the Post-Build, and probably Pre-Build Event properties are not actually aggregate properties that support the $(Inherit) macro. Is this correct? Or is there some way to achieve this?

    Thank you.
    Thursday, May 7, 2009 6:56 PM

Answers

  • Check this MSDN library page for the types of properties.  The custom build step, "command line" property looks like a simple property to me.  You'd need an aggregate property to get what you are looking for.  Note that "additional dependencies" on that same page is aggregate.  Visible in the dialog you get when you click the button with the dots.

    I think you're stuck.

    Hans Passant.
    • Marked as answer by nobugz Friday, May 8, 2009 12:15 PM
    Thursday, May 7, 2009 8:12 PM

All replies

  • Check this MSDN library page for the types of properties.  The custom build step, "command line" property looks like a simple property to me.  You'd need an aggregate property to get what you are looking for.  Note that "additional dependencies" on that same page is aggregate.  Visible in the dialog you get when you click the button with the dots.

    I think you're stuck.

    Hans Passant.
    • Marked as answer by nobugz Friday, May 8, 2009 12:15 PM
    Thursday, May 7, 2009 8:12 PM
  • Yeah, I think it isn't setup internally as an aggregate property too, but it's hard to understand why it was designed this way because it uses the aggregate property editor for editing the values.

    One would imagine that the Command Line field should be inheritable too. It's not unthinkable that each vsprops property sheet would need to do some Post-Build Events.

    Thanks.
    Friday, May 8, 2009 5:02 AM
  • Man, this is still not fixed and its anoying as hell. Sometimes I really have to wonder if MS compiles the Windows code with VS. No inheritance of post-build steps is a serious bug!
    Thursday, October 24, 2013 10:25 PM
  • Man, this is still not fixed and its anoying as hell. Sometimes I really have to wonder if MS compiles the Windows code with VS. No inheritance of post-build steps is a serious bug!
    I'll have to agree with this.  This is a nightmare because I have to edit about 300 projects individually that all share common steps but many also have there own custom steps. :(
    Wednesday, November 27, 2013 12:48 AM
  • I found that using %(Command) will use the previous build-event command in the current build event.


    • Edited by discomurray Sunday, March 30, 2014 8:29 PM language
    • Proposed as answer by shutow Thursday, August 20, 2015 4:36 PM
    Sunday, March 30, 2014 8:29 PM
  • Confirmed that this works in VS2010. Absolute genius. Couldn't find any information about that macro in MS docs!!
    Friday, January 29, 2016 12:21 PM