开发者

Solution Explorer Filters in Visual Studio 2010

I'm looking for syntax information on the new Visual Studio 2010 .vcxproj.filters file. Is there a way to do wildcard filtering based on more than just the extension?

Here's the scenario:

We have a tool that writes a project file for Visual Studio 2005 defining all the messages in an application, along with the associated generated classes. In the project file, we grouped the C++ files not only by h/cpp, but also by user-defined filters, so our project might look something like this:

  • messages      ( <-- that's the .vcproj file)
    • 开发者_JAVA百科GENERATED_MSGS
      • COM
        • h
          • COMRequest.h
          • COMRequestAck.h
        • cpp
          • COMRequest.cpp
          • COMRequestAck.cpp
      • DATA
        • h
          • DATARequest.h
          • DATARequestAck.h
        • cpp
          • DATARequest.cpp
          • DATARequestAck.cpp
      • ORDER
        • h
        • cpp
    • Header Files
      • HandCraftedMessage1.h
      • HandCraftedMessage2.h
    • Source Files
      • HandCraftedMessage1.cpp
      • HandCraftedMessage2.cpp
    • MyFileThatDefinesTheMessages.xml

The filters (COM, DATA, ORDER, etc.) are stored in the .vcproj file:

...
<Files>
    <Filter Name="GENERATED_MSGS">
        <Filter Name="COM">
            <Filter Name="COM">
                <Filter Name="h">
                    <File RelativePath=".\COMRequest.h"/>
...

In Visual Studio 2010, the files defined for the project are in the .vcxproj file, but the filters for how to display them are stored in the .vcxproj.filters file. Since our filters are always determined by the first part of the class name, I was hoping to get away with only creating the .vcxproj file with message generation tool and modifying the .filters file to use wildcards to put the files in the correct filter. For instance, a file named ORDERRequest.h should go into the GENERATED_MSGS/ORDER/h filter. Is there a way I can define a wildcard to do this, so that ORDER*.h would go in one folder, while COM*.h would go in a different folder? I have run across the <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> tag, but this is not flexible enough for me, since I want to break it down more than just by extension.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜