locked
How to add a macro and Change the project name based on Macro RRS feed

  • Question

  • I am working using VC++, Have created a project Test, hence the executable(exe) is created by this Name Test, i.e Test.exe

    This project works in 2 modes based on Flag, flagMode. If flagMode == 1 then the exe is built for mode 1, and if the flagMode == 2 then the exe is built for Mode 2.

    Note: its is the same source and header files and same project.

    The requirement is to add Mode tag to executable based on build (flagMode) to which the flag is set. (example if the flagMode ==1 then I want the exe name to be Test_Mode1.exe else it should be Test_Mode2.exe, )

    I am using VS 2008.

    i also want to know how we can add macro in post build settings of project.

    I cannot have different configuration.

    Regards Mos

    Monday, October 3, 2011 11:48 AM

Answers

  • Hi mos1125,

    >> i also want to know how we can add macro in post build settings of project.

    Please try the following steps to add macro to the post build event.

    1.       Right-click your project select properties;

    2.       In the property window, goto Configuration Properties->Build Events->Post-Build Event;

    3.       Click the “…” button in the Command Line box;

    4.       Click Macros button, select the macros ,and then click the insert button.

    >>The requirement is to add Mode tag to executable based on build (flagMode) to which the flag is set. (example if the flagMode ==1 then I want the exe name to be Test_Mode1.exe else it should be Test_Mode2.exe, )

    What the difference between these two modes? If the difference is the configuration, I recommend you use the batch build( Build->Batch Build).

    If you want to output the different exe name , I recommend you to use Output element in the msbuild. You can refer to http://msdn.microsoft.com/en-us/library/ms164287.aspx .

    Or you can try to create two file named Test_Mode1 and Test_Mode2. Then build them separately.

    Reference:

    Using MSBuild to Build Multiple Configurations

    http://stackoverflow.com/questions/5511274/using-msbuild-to-build-multiple-configurations

     

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by lucy-liu Monday, October 10, 2011 9:27 PM
    Wednesday, October 5, 2011 8:36 AM

All replies

  • Hello Mos,

    Based on your description, this thread is about MSBuild, so I will move it to MSBuild forum, there you will get better support. Thanks for your understanding.

    Thanks,


    Jack Zhai[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 4, 2011 5:50 AM
  • Hi mos1125,

    >> i also want to know how we can add macro in post build settings of project.

    Please try the following steps to add macro to the post build event.

    1.       Right-click your project select properties;

    2.       In the property window, goto Configuration Properties->Build Events->Post-Build Event;

    3.       Click the “…” button in the Command Line box;

    4.       Click Macros button, select the macros ,and then click the insert button.

    >>The requirement is to add Mode tag to executable based on build (flagMode) to which the flag is set. (example if the flagMode ==1 then I want the exe name to be Test_Mode1.exe else it should be Test_Mode2.exe, )

    What the difference between these two modes? If the difference is the configuration, I recommend you use the batch build( Build->Batch Build).

    If you want to output the different exe name , I recommend you to use Output element in the msbuild. You can refer to http://msdn.microsoft.com/en-us/library/ms164287.aspx .

    Or you can try to create two file named Test_Mode1 and Test_Mode2. Then build them separately.

    Reference:

    Using MSBuild to Build Multiple Configurations

    http://stackoverflow.com/questions/5511274/using-msbuild-to-build-multiple-configurations

     

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by lucy-liu Monday, October 10, 2011 9:27 PM
    Wednesday, October 5, 2011 8:36 AM