$(OutDir) Does not match Output Directory ?

Michael Faynberg 21 Reputation points
2021-11-09T22:15:26.61+00:00

Hi,
I converted an old, almost 30-years old C project to VS2019 :) which took a lot of effort on its own. Now everything seems to be OK, except that the predefined macros misbehave, and I am not aware of a way to fix it. What happens looks like this:

  1. The "Output Directory" and "Intermediate Directory" are customized in order to point at binary and intermediate directory trees rather than to mess up with the source tree;
  2. The %(Lib.OutputFile) property looks like $(OutDir)$(TargetFileName) - and I was hoping the $(OutDir) would automatically follow the "Output Directory" definition.
  3. However it is not the case. The $(OutDir) seems to have thte life of its own and does not match my setup. As a result, after the build is over I find a bunchof .tlog files at the wrong location (BTW, how to disable them being generated), and even though the built program is placed to a correct location, when i start debugging it is not started because the Debugging "Command" is defined using the $(OutDir).

That is, how to bring the $(OutDir) in correspondence with the "Output Directory" and avoid further customizing the properties, like making the Debugging "Command" something unusual?

Thank you!

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,449 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,912 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,144 questions
{count} votes

Accepted answer
  1. RLWA32 48,156 Reputation points
    2023-08-26T12:26:09.3933333+00:00

    @Michael Faynberg I used the most recent C++ project file that you uploaded as my starting point. After making a few changes to reflect that I don't have your files or the v110 toolset I was able to solve the MSBuild message issue. The project file that I used is attached JpegLib.vcxproj.txt and the folder contents for the project (solution file and the project file in the same folder) and its output are as follows -

    SolutionDir

    Obj output -

    ObjDir

    Bin output -

    BinDir

    Batch build output -

    GoodBuilds


2 additional answers

Sort by: Most helpful
  1. Michael Faynberg 21 Reputation points
    2023-08-28T22:07:55.3833333+00:00

    Hello RLWA32, thank you so much for your time and help! In fact, as soon as I manually added the line:

    <TargetPath>$(OutDir)$(TargetName)$(TargetExt)</TargetPath> 
    

    to the project files (one line per each configuration per each project) the message MSB8012 disappeared - and that is great!

    Two questions left though:

    1. This is out of curiosity: I did not notice (maybe I was not tedious enough) any visible changes in the project's property pages, i.e. could it be done from the VS using the project's property pages rather than by manually editing the project file?
    2. Despite the build looks clean, it still executes the pre-build step I have defined. I was hoping nothing at all would happen as long as neither source file was changed (and all object and executable files are still in place). However, when I immediately start new build after the previous build finished, that new build starts. Is it by design? How would it be possible to avoid executing the pre-build step if there is no reason to perform the build itself?

    Thank you once again!

    Mike Faynberg


  2. Michael Faynberg 21 Reputation points
    2023-08-29T17:24:25.4766667+00:00

    Please discard the item 2 - i figured it already!

    0 comments No comments

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.