I need to make a custom C++ project wizard that is the same as built in c++ wizard. It doesn't matter which type. It could be console type project.
What I need to change is only to add a path to custom include director开发者_StackOverflow中文版y and a path to custom library directory.
How can I do this?
I think you want to look into project templates.
http://msdn.microsoft.com/en-us/library/s365byhx.aspx
Here is a link to writing a new wizard http://msdn.microsoft.com/en-us/library/7k3w6w59.aspx
I recommend storing those types of settings like custom paths in a property sheet. ( .props file.) Then you can change your mind later and have this change affect multiple projects. Your wizard could simply add this .props file to the .vcxproj. I also prefer .props files because you can also define additional user macro's that the vcxproj and other .props files can use.
http://msdn.microsoft.com/en-us/library/a4xbdz1e.aspx
The built-in wizards are found in [vsinstalldir]\vc\VCWizards\AppWiz The additional files that register these project types are found in [vsinstalldir]\vc\VCprojects\ You could alter those or copy them to get the rest of the c++ wizard functionality.
Additional Idea:
You may notice that .vcxproj's typically have an entry like this:
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
This means that the existing wizard made an entry that tries to bind to a user property sheet if one exists.
c:\users\<username>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>c:\Custom\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ItemDefinitionGroup>
</Project>
I recommend the second idea. Adding include, lib path, and other types of settings are a common scenario and the existing wizard allows for this by having a reference to user property sheets.
精彩评论