A prebuild event always runs before up to date check

John 76 Reputation points
2022-03-09T08:10:22.177+00:00

Hi,

I am using Visual Studio 2022, I need a prebuild event (which can change the C++ source code conditionally) to be always triggered before the up-to-date check on the targeted C++ code.

Could you teach me how to do that? Thank you.

John

Developer technologies | C++
{count} votes

2 answers

Sort by: Most helpful
  1. John 76 Reputation points
    2022-03-10T12:30:53.213+00:00

    I finally figured out a way to do it, which is Utility project: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa733962(v=vs.60)?redirectedfrom=MSDN

    Then I only need to disable the up to date check for that Utility project only.

    Thanks all the comments.

    1 person found this answer helpful.

  2. Viorel 122.6K Reputation points
    2022-03-09T11:34:31.02+00:00

    Consider an indirect method too: creating a Custom Build Step (in Project Properties). If you enter into Outputs field a file name that never exist, then the command will be always executed. Also select an appropriate Execute Before option.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.