English 中文(简体)
是否可以自定义内置的Visual Studio 2010 C++项目向导?
原标题:Is it possible to customize the built-in Visual Studio 2010 C++ project wizards?

我需要制作一个自定义的C++项目向导,它与内置的C++向导相同。哪种类型并不重要。它可以是控制台类型的项目。

我需要更改的只是添加一个自定义包含目录的路径和一个自定义库目录的路径。

我该怎么做?

问题回答

我认为您需要查看项目模板。

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

我建议将这些类型的设置(如自定义路径)存储在属性表中。(.props文件。)然后你可以稍后改变主意,让这个改变影响多个项目。您的向导可以简单地将.props文件添加到.vcxproj中。我也更喜欢.props的文件,因为您还可以定义vcxproj和其他.props可以使用的其他用户宏。

http://msdn.microsoft.com/en-us/library/a4xbdz1e.aspx

The built-in wizards are found in [vsinstalldir]vcVCWizardsAppWiz The additional files that register these project types are found in [vsinstalldir]vcVCprojects You could alter those or copy them to get the rest of the c++ wizard functionality.

其他想法:

您可能会注意到.vcxproj s通常有这样一个条目:

  <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>

这意味着现有向导生成了一个条目,该条目试图绑定到用户属性表(如果存在)。

c:users<username>AppDataLocalMicrosoftMSBuildv4.0Microsoft.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:CustomInclude;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
   <ItemDefinitionGroup>
</Project>

我推荐第二个想法。添加include、lib路径和其他类型的设置是一种常见的场景,现有向导通过引用用户属性表来实现这一点。





相关问题
building .net applications without Visual Studio

I m interested to hear about people working with building .net applications using MSBuild, NAnt or similar tools. What are you using, why are you using it instead of the VS IDE? I like to use ...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Visual Studio 2010 Beta 2: Can I print in color?

I have to turn in a hard copy of some code with an assignment. Is there any way in Visual Studio 2010 to print C# source code with syntax highlighting? PS: The assignment is solving a math problem, ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

热门标签