VSPackage: How to create a custom virtual node like References nodeHello,<br/>     I have a C# flavored project and I want to add some custom nodes to my project where the only options when you right click on them is to add or remove a custom project item that I have already created, so I want it to be like the References node in that it cannot be deleted renamed and it only has 2 context menu options. Any idea or links on how to do something like this would be greatly appreciated.<br/><br/>Thanks<br/><br/>Kenny© 2009 Microsoft Corporation. All rights reserved.Thu, 02 Jul 2009 14:14:05 Zb31b0535-3f39-425c-92e6-7472793bcb93http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#b31b0535-3f39-425c-92e6-7472793bcb93http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#b31b0535-3f39-425c-92e6-7472793bcb93Kenny Chinnhttp://social.msdn.microsoft.com/Profile/en-US/?user=Kenny%20ChinnVSPackage: How to create a custom virtual node like References nodeHello,<br/>     I have a C# flavored project and I want to add some custom nodes to my project where the only options when you right click on them is to add or remove a custom project item that I have already created, so I want it to be like the References node in that it cannot be deleted renamed and it only has 2 context menu options. Any idea or links on how to do something like this would be greatly appreciated.<br/><br/>Thanks<br/><br/>KennyThu, 25 Jun 2009 18:24:48 Z2009-06-25T18:24:48Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#71068b01-bddc-4b27-a273-66649a888ef1http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#71068b01-bddc-4b27-a273-66649a888ef1Reed Shiltshttp://social.msdn.microsoft.com/Profile/en-US/?user=Reed%20ShiltsVSPackage: How to create a custom virtual node like References nodeThis is actually easier than you would think (and I have bunches of custom containers and node types)...<br/>a) Create a container class (like a folder) which inherits from HierarchyNode.<br/>b) Create an item class (like a file) which also inherits from HierarchyNode.<br/><br/>To make it impossible to rename from explorer, override the &quot;SetEditLabel&quot; method and throw NotImplementedException (yes, it's a rather silly technique, but that's the only thing that works).  I also override &quot;CanDeleteItem&quot; and return false.<br/><br/>For the container class - override the GetProperty() method and return true for &quot;VSHPROPID_Expandable&quot;.<br/>For the item class - don't return true for the ...Expandable (of course).<br/><br/>Take a look at the FileNode and FolderNode classes in the MPF ProjectBase and you'll see how easy this ends up being.<br/><br/>Hope this helps,<br/>Reed SHilts<br/><br/>Thu, 25 Jun 2009 23:19:39 Z2009-06-25T23:19:39Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#cf8d90c1-dee1-49e0-996f-af6f3c7d120fhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#cf8d90c1-dee1-49e0-996f-af6f3c7d120fKenny Chinnhttp://social.msdn.microsoft.com/Profile/en-US/?user=Kenny%20ChinnVSPackage: How to create a custom virtual node like References nodeThanks for the repsonse but we are not using MPF so we cannot use the HierachyNode class as it uses ProjectNode. Is there any way to do this sort of thing using a Flavored C# project? <div><br/></div> <div><br/></div> <div>Thanks</div> <div>Kenny</div>Wed, 01 Jul 2009 17:40:40 Z2009-07-01T17:40:40Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#192387a5-7d73-405f-bdbe-f8eef090971ehttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#192387a5-7d73-405f-bdbe-f8eef090971eNancy Shaohttp://social.msdn.microsoft.com/Profile/en-US/?user=Nancy%20ShaoVSPackage: How to create a custom virtual node like References node<p>Hi Kenny,</p> <p>Based on my  understanding, you can use Project Template to add a new ProjectNode as <strong>Reference</strong> Node in treeview. You can export a C# project template by <strong>File</strong>&gt;<strong>Export Template...</strong> and  then customize your project template, please refer to following code snippet about how to add a new folder note(named <strong>NewFolder1</strong>) in project template:</p> <pre lang=x-xml>&lt;TemplateContent&gt; &lt;Project TargetFileName=&quot;ConsoleApplication.csproj&quot; File=&quot;ConsoleApplication.csproj&quot; ReplaceParameters=&quot;true&quot;&gt; &lt;Folder Name=&quot;NewFolder1&quot; TargetFolderName=&quot;NewFolder1&quot; /&gt; &lt;ProjectItem ReplaceParameters=&quot;true&quot; TargetFileName=&quot;Program.cs&quot;&gt;Program.cs&lt;/ProjectItem&gt; &lt;Folder Name=&quot;Properties&quot; TargetFolderName=&quot;Properties&quot;&gt; &lt;ProjectItem ReplaceParameters=&quot;true&quot; TargetFileName=&quot;AssemblyInfo.cs&quot;&gt;AssemblyInfo.cs&lt;/ProjectItem&gt; &lt;/Folder&gt; &lt;/Project&gt; &lt;/TemplateContent&gt;</pre> For more information, please see : <a href="http://msdn.microsoft.com/en-us/magazine/cc188697.aspx">Create Reusable Project And Item Templates For Your Development Team</a>.<br/><br/>If I misunderstood you, or you have any questions, please let me know.<br/><br/>Best Regards,<br/>Nancy <hr class=sig> Please remember to mark the replies as answers if they help and unmark them if they provide no help. <br/><a href="http://cfx.codeplex.com/">Welcome to the All-In-One Code Framework!</a> If you have any feedback, please tell us.Thu, 02 Jul 2009 01:51:11 Z2009-07-02T01:51:56Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#7fae39e6-b9ee-4bf6-8fa5-79b817009a26http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b31b0535-3f39-425c-92e6-7472793bcb93#7fae39e6-b9ee-4bf6-8fa5-79b817009a26Kenny Chinnhttp://social.msdn.microsoft.com/Profile/en-US/?user=Kenny%20ChinnVSPackage: How to create a custom virtual node like References nodeHi Nancy, <div>   Thanks for the response, but I think you misunderstood me. I need to create a custom folder in which all the user can do is add or remove a custom project item I have created. I want it to be sort of like the References folder, except you can add my custom project items instead of references. Does that make senese? If you have any questions for me please let me know. </div> <div><br/></div> <div>Thanks</div> <div>Kenny</div>Thu, 02 Jul 2009 14:14:05 Z2009-07-02T14:14:05Z