Reputation: 8941
Using Visual Studio 2012, I'd like to create a C++ project folder called "Include Files", which has the same characteristics as the well known folder "Header Files". That is, the files in Include Files have a cpi extenson and will be parsed out for use with InteliSense, and also can be precompiled.
I'm able to create the folder but files within it aren't parsed. I've tried setting the type to C++ Header file. Nothing seems to work. The files work fine when given a hpp extension and put into Header Files folder.
Upvotes: 1
Views: 4616
Reputation: 8941
Here's some raw information about how I implemented, CPI
, the custom file extension similar in purpose to .h. My task was to create a program that dynamically creates Visual Studio 2012 C++ solutions and projects. This was needed because VS templates don't work with C++, only with .Net.
I created a Visual Basic script file to create solution and project files. It inserted the following XML into a custom vcxproj file. There are XML tags other than None
such as ClCompile or Include. The None
tag seems to work for my purposes; enables parsing, Intellisense, and context menu options.
<ItemGroup>
[Do following pattern for each CPI file]
<None Include="MyCPI.CPI">
<FileType>CppHeader</FileType>
</None>
</ItemGroup>
I created the following XML and inserted into the vcxproj.filters files:
[Insert within ItemGroup at beginning of file. The GUID is the same as C++ Header Files. I'm not sure what that means.]
<Filter Include="Include Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>cpi</Extensions>
</Filter>
<ItemGroup>
[Do following pattern for each CPI file]
<None Include="MyCPI.CPI">
<Filter>++Include Files</Filter>
</None>
</ItemGroup>
Upvotes: 0
Reputation: 66224
If it is anything like VS2010 this is done from the Tools/Options/Text-Editor dialog options. Under the tree item "File Extensions" you can add custom file extensions and have them treated with the editing experience of your choice.
To simulate your case I did the following:
Proceed as normal. Open any CPI file and it should now display with the same syntax highlighting, and IntelliSense options, as any c/cpp/h/hpp, etc file.
At least thats how I do it with my custom file extensions. It sounds like you have the filtering into subfolders the way you want it already.
Upvotes: 2