visualstudiohidingitemsfromsolutionexplorer

Cancel Edit [WikiEntry.PreviewButtonText] Save

How do I get items to not show up in solution explorer? Is there some kind of attribute I can tag the items with so they will be ignored by the IDE?


For example, suppose you have the following in one of your .CSPROJ project files:
		 [<ItemGroup>]
		   <!-- I don't want this to show up inside of the ide solution explorer -->
		   [<SpecialItem] Include="foo.special" />
	

		   <!-- But these I do want to show up inside of Solution Explorer -->
		   <Compile Include="a.cs" />
		   <Compile Include="b.cs" />
		 [</ItemGroup>]
	

Solution explorer would show it like this:

http://alexkipman.members.winisp.net/channel9wikiimages/wikiFAQVisualStudioHidingItemsFromSolutionExplorer01.jpg

The good news is that there is a special item meta-data the IDE knows about / respects called Visible. Setting this piece of item meta-data to false will result in Solution Explorer no longer showing that item. Consider the same project after we do this:
		 [<ItemGroup>]
		   <!-- I don't want this to show up inside of the ide solution explorer -->
		   [<SpecialItem] Include="foo.special" >
		      <Visible>false</Visible>
		   [</SpecialItem>]
	

		   <!-- But these I do want to show up inside of Solution Explorer -->
		   <Compile Include="a.cs" />
		   <Compile Include="b.cs" />
		 [</ItemGroup>]
	

Solution explorer would now show it like this:

http://alexkipman.members.winisp.net/channel9wikiimages/wikiFAQVisualStudioHidingItemsFromSolutionExplorer02.jpg

Note: Even though Solution Explorer does not show the item, the item is still part of the project manifest and can be consumed and referenced in this project through the @(SpecialItem) syntax
Microsoft Communities