Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide files in .csproj without excluding them from build

Is it possible to hide files/folders in .net core csproj without excluding them from build? I have a folder containing generated files which I would rather see they are not visible inside Solution Explorer in Visual Studio.

like image 476
redman Avatar asked Aug 10 '17 12:08

redman


1 Answers

You can set the Visible="false" attribute on the items.

For an SDK-based project (.net core / asp.net core templates), you could add e.g.:

<ItemGroup>
  <Content Update="**/*.css" Visible="false" />
</ItemGroup>

Depending on your project type (=> defaults), you might have to replace Content with None for the particular type, or even Compile for generated code files.

like image 107
Martin Ullrich Avatar answered Oct 20 '22 10:10

Martin Ullrich