Brian
Brian

Reputation: 1231

Extend the Visual Studio C++ Build Process

A found an article (Extend the Visual Studio Build Process) that explained how to override build targets in a C# project file. I tested this, and it seems to work well. However, what I really want to do is override a build target in a C++ project (with Visual Studio 2005). The problem is that C++ projects use different XML. Instead of having <project> as the root, C++ projects have <VisualStudioProject> as the root. When I add the <target> tag to a C++ project file and try to open the project in Visual Studio, I get this error:

The following error has occurred during XML parsing:

File: [Path to Project File].vcproj Line: 304 Column: 30 Error Message: Element 'Target' is unexpected according to content model of parent element 'VisualStudioProject'.

The file '[Path to Project File].vcproj' has failed to load.

How can I override a Visual Studio build target for a C++ project? Or is there a better way to customize what happens during a C++ build?

Upvotes: 0

Views: 554

Answers (1)

Martin Ba
Martin Ba

Reputation: 38795

In Visual Studio 2005 there are no build "targets" for C++ builds as the C++ build system does not use MSBuild.

However, VC++2005 defines the Pre-Build, Pre-Link, Post-Build Events as well as the ability to add a Custom Build Step for non-standard files.

You may be able to achieve what you want using these settings.

Note:

  • VC++2005 projects can be built using MSBuild, it's just not what Visual Studio does out of the box.
  • Visual Studio 2010 uses MSBuild for all project types.

Upvotes: 1

Related Questions