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

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

问题描述

是否可以在 .net core 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="false" 属性.

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

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

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

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

根据您的项目类型(=> 默认值),对于特定类型,您可能需要将 Content 替换为 None,甚至Compile> 用于生成的代码文件.

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天全站免登陆