How to fix MSB8012 (Lib.OutputFile)? - by BobH2

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


12
0
Sign in
to vote
ID 523864 Comments
Status Closed Workarounds
Type Bug Repros 11
Opened 1/8/2010 2:00:11 AM
Access Restriction Public

Description

I am getting the following warning:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1095,5): warning MSB8012:
TargetPath(E:\Test\Lib10\Lib10.lib) does not match the Library's OutputFile property value (E:\Test\Lib10\x64\Release\Lib10.lib).
This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).


I can see where to change $(OutDir), $(TargetName), and $(TargetExt).

I do not see where to change %(Lib.OutputFile) and with the "%" prefix I am assuming it is not a macro but probably a path under "Librarian", except I do not see a "OutputFile" variable. In fact, I do not see "E:\Test\Lib10\Lib10.lib" anywhere, including the Command Line summary.

When I hit [F1] on "MSB8012", I get a topic called "Output Window". In VS6, this would have brought up a help screen to explain the error.

Also, what's with "Librarian"? There's no librarian here. It's a dumb name. Someone needs to change the name to "Library" or "Linker" or "Library Linker".


I keep my *.libs in my project's root folder but modify the name for release and debug and want to append "x64" for the 64 bit modules and end up with the following:

Lib10.lib
Lib10D.lib
Lib10-x64.lib
Lib10D-x64.lib

I then proceeded to modify my output path a bit more and got the following messages:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1095,5): warning MSB8012: TargetPath(E:\Test\Lib10\Lib10.lib) does not match the Library's OutputFile property value (E:\Test\Lib10\Lib10-x64.lib).

This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).


1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1097,5): warning MSB8012: TargetName(BPE_Lib10) does not match the Library's OutputFile property value (BPE_Lib10-x64).

This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).


The Lib file was created in the folder and with the name I wanted.


THEN, I actually read and tried to understand the error, modified Configuration Properties | General | TargetName to "Lib10-x64", the messages disappeared, and the file was produced ok.
Sign in to post a comment.
Posted by laduran on 2/20/2012 at 10:53 AM
@aao123

I think you need to relax man. Or find another line of work. If you've ever worked with Eclipse with Android, you would know things could be much, much worse than Visual Studio.
Posted by aao123 on 1/20/2011 at 12:31 PM
you people have some nerve :
"In this release we dont have that functionality " and "... we have now become more transparent"

You people broke the existing(and very very useful) functionality with your freaking transiency enhancements - verifying build output is time consuming enough without your useless enhancements. It is now up to a user to create the workaround, is that the attitude? What is next - build your own visual studio?
Posted by RocketRob on 10/13/2010 at 3:02 PM
This warning suddenly came up in my builds today... after never having seen this in the past. Did something change in the Windows Updates from last night (10/12/2010)? I have never modified the CPPBuild.targets files and really shouldn't have to do so!

I am getting these three warnings in EVERY C++ project I have. All of these projects were defined in VS2010 and are not upgrades from prior versions:

2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\CODE\MSXP\Debug\DBWizard.exe) does not match the Linker's OutputFile property value (). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.exe) does not match the Linker's OutputFile property value (). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(992,5): warning MSB8012: TargetName(DBWizard) does not match the Linker's OutputFile property value (). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).

How do I proceed?
Posted by BobH2 on 8/22/2010 at 11:26 AM
Here I go again.

I fixed the last projects by fiddling. This one does seem to fiddle. I've tried a few different things, here's the last scenario.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(E:\PROJECTFOLDER\PROJECTNAME\VS10\Debug\TARGETNAME.dll) does not match the Linker's OutputFile property value (d:\xxx\BIN\TARGETNAME.DLL). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).

Settings
========
General | OutputDirectory:        .\Debug
General | IntermediateDirectory:    .\Debug
General | TargetName            $(ProjectName)    -> PROJECTNAME
Linker | General | Output File:        d:\xxx\BIN\TARGETNAME.DLL

I changed these from the VS6 conversion settings to:
General | OutputDirectory:        .\Debug        -> DEBUG
General | IntermediateDirectory:    .\Debug        -> DEBUG\

Macros was:
$(OutDir)    = .\Debug

And the macros are now:
$(OutDir)            = E:\PROJECTFOLDER\PROJECTNAME\VS10\DEBUG\
$(ProjectDir)    = E:\PROJECTFOLDER\PROJECTNAME\VS10\
$(TargetExt)    = .dll
$(TargetName)    = TARGETNAME
$(TargetPath)    = d:\Release\bin\TARGETNAME.DLL


The documentation states:

$(TargetName) The base name of the primary output file for the build.
$(TargetExt) The file extension of the primary output file for the build. It includes the '.' before the file extension.
$(TargetPath) The absolute path name of the primary output file for the build (defined as drive + path + base name + file extension).
$(OutDir) Path to the output file directory, relative to the project directory. This path should have a trailing slash. This resolves to the value for the Output Directory property.

The documentation is incomplete. "Primary Output File" is, I assume the end product of my compile and link. TargetName and TargetExt is, I hope just the filename and extension of the final output. And I would have assumed that the linker would create the file where I want it and with the name I want, just like in VS6.

I do not see/understand what the problem is here. So what do i do to fix this?

How do I compile and create debug and release intermediate files in one partition, but deposit the end result in a BIN folder in my release partition for testing and debugging, without getting warning messages?

Thanks, Bob.
Posted by BobH2 on 7/10/2010 at 12:56 PM
I have now installed the production version of Visual Studio 2010 and am still getting the same problem:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(E:\Test\Lib10\.\Debug\Lib10.lib) does not match the Library's OutputFile property value (E:\Test\Lib10\Lib10D.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1153,5): warning MSB8012: TargetName(Lib10) does not match the Library's OutputFile property value (Lib10D). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

I have no problem fixing this manually but where do I go? What do I do? Is there a help topic available yet?

It looks like the library is being created correctly, but I do not like warnings.

Thanks,
Bob.

Posted by Microsoft on 4/22/2010 at 12:34 PM
Hi Bob,

Thanks for reporting this issue. We are closing the bug, if you continue to see this issue after my last recommendation please feel free to reactivate the bug.

Thanks,
Amit Mohindra
Visual C++ Team
Posted by Microsoft on 2/18/2010 at 12:12 PM
Hi Bob,

About the original bug the warning is generated because in Visual Studio 2010 we have moved the C++ build system to be based on MSBuild. In earlier versions of Visual Studio when you changed the output file property the "TargetName" "TargetExt" properties were changed in background by the product itself. In this release we dont have that functionality and we have now become more transparent and warn the user to make sure that the output file property does match with the "OutDir" "TargetName" and "TargetExt" properties.

Your can change %(lib.outputfile) by going to project properties "Configuration Properties->Librarian->Output File".

Regarding your response copying final linked output should be achievable with VS2010. I think it might be a sideeffect of the warning that are getting generated during build.

Can you verify that is the case?

Thanks,
Amit Mohindra
Visual C++ Team
Posted by Microsoft on 1/17/2010 at 7:02 PM

Thank you for your feedback, We are currently reviewing the issue you have submitted.
Posted by BobH2 on 1/17/2010 at 7:22 AM
I am now getting to compiling and linking my first VS10 project that will use the library.

I keep all my source code on my "E\:" drive, including intermediate files etc. The *.LIB files that are linked into projects also reside on the "E:\" drive.

My final ouptut, that is files suchas *.DLLs and *.EXEs that released to customers get compiled to the "D:\" Drive. In this way, I have a clear set of source code folders that are backed up, and a clear set of customer release folders that are zipped up for customers, with no possibility of sending irrelevant or source code files to customers.

This is the way I have always done it with VS6.

VS10 looks like it is insisting that I produce my final linked file in the intermediate files path somehow. I should be able to just set the final path and file name in Configuration Properties | Linker | General | Output File.

Posted by BobH2 on 1/17/2010 at 3:59 AM
I have just uploaded the project settings.
Posted by Microsoft on 1/10/2010 at 9:31 PM
Thanks for reporting the issue.
In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.

Could you please attach a zipped project file to this feedback through our site to help us reproduce the issue?

Thanks again for your efforts and we look forward to hearing from you.
Visual Studio Product Team