在.csproj中隐藏文件而不将其从构建中排除 [英] Hide files in .csproj without excluding them from build

查看:148
本文介绍了在.csproj中隐藏文件而不将其从构建中排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在.net核心csproj中隐藏文件/文件夹而不将其从构建中排除?我有一个包含生成文件的文件夹,我希望它们在Visual Studio的解决方案资源管理器中不可见。

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.

推荐答案

设置 Visible =错误 属性

对于基于SDK的项目(.net core / asp.net核心模板) ,则可以添加例如:

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.

这篇关于在.csproj中隐藏文件而不将其从构建中排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆