2

I want to separate the objects files from the output binary file in Visual Studio 2017 but I then I get the warning MSB8012 - TargetPath does not match the Library's OutputFile property value.

Is there some way to skip this warning?

RegedUser00x
  • 2,313
  • 5
  • 27
  • 34
  • Can you clarify a bit? Is your target an object library, and you want the final "lib" file to be in a different location to the intermediate "obj" files? Or is the target something else? – Adrian Mole Mar 05 '20 at 14:23
  • Part of the build overhaul in VS2010, OutputFile was retained to keep old projects compatible. But shouldn't be changed, use Project > Properties > General > "Output Directory" instead. – Hans Passant Mar 05 '20 at 15:21
  • @HansPassant output binary file is .dll so preferably only this should go in the directory of interest but "Output Directory" is used for other files like .exp, .lib and .pdb which should remain in an intermediate directory. – mireazma Mar 19 '21 at 15:19
  • It seems odd to me that the IDE offers the option to specify a different output file name and location if that's going to immediately lead to warnings that need to be supressed. My project is a static library and I want to build it in the 'right' place for the other projects in my project pick up without having to set every static library's path or have a build step to move the files. It makes development much faster - I don't have to worry about manually moving them. I know I could use a pre and post build event to achieve this, but setting the OUT path seems better to me. – AndyB Jun 08 '23 at 12:26

1 Answers1

1

Is there some way to skip this warning?

If you still want this warning MSB8012 not showing in VS, you can add this into xxxx.xxxproj file:

<PropertyGroup>
<MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
</PropertyGroup>

Note this is a new feature since VS2017.

In addition, just as Hans said, you can just fix this warning,you can refer to this similar case to try.

Hope it could help you.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41