Visual Studio 2010, C++, Linker and Librarian Output Files, and Target Name
Visual Studio 2010 and its corresponding MSBuild schema files have finally brought C++ project files into the 21st century. C++ project files not only get a new extension (vcxproj), they get some new properties as well, such as TargetName and TargetExtension.
In prior versions of Visual Studio, other than changing the name of the project, it was necessary
to use the Linker’s (DynamicLibrary) or Librarian’s (StaticLibrary) OutputFile properties to change the name of the build artifact.
While these properties are still present in Visual Studio 2010, in the latest MSBuild schema (in which there is an error that you’ll run into if you are parsing it manually — there is no “Lib” child of “LinkItem” type in the “ItemDefinitionGroup” element) there is a new way of changing the name of the build artifact. In the General property sheet you can specify a TargetName property which defaults to $(ProjectName).
So even if your project name is a windows application named “HelloWorld” and Product Management says it needs to be called “NoReasonForThisChangeOtherThanWeNeedToDrawAPaycheckSoItNeedsToLookLikeWeAreDoingSomething”, you can simply change the TargetName property and that is the artifact that will be created.
Additionally, if you don’t like the default extension based on project type (Application=exe, DynamicLibrary=dll, StaticLibrary=lib) you can change the target’s extension with the TargetExtension property.
Filed under: software development | Leave a Comment
Tags: .net, c#, visual studio