“Folder tag” 在 csproj 中的意思是什么?

huangapple go评论57阅读模式
英文:

What is meaning of Folder tag in csproj

问题

在.NET C#项目中,使用遵循<Project Sdk="Microsoft.NET.Sdk">模板的csproj文件,我有一些类似下面的项目组:

  <ItemGroup>
    <Folder Include="Internal\" />
  </ItemGroup>

我试图通过官方文档理解这个标签的含义,但我没有找到任何信息。

所以,我的问题是,这个标签是什么(它的含义是什么)?以及我何时将我的目录添加到csproj中作为Folder标签?

我尝试在https://stackoverflow.com/a/71049728/1539100中进行搜索,但在Bing中没有找到有用的结果。

谢谢。

英文:

in .NET C# project, with csproj file that follow <Project Sdk="Microsoft.NET.Sdk"> template, I have some item group like below

  <ItemGroup>
    <Folder Include="Internal\" />
  </ItemGroup>

I try to understand what is meaning of this tag with official documents. But I do not find anything.

So, my question is, What is this tag (What is meaning of that?)? and When I add my directory in csproj as Folder tag?

I try the search query in https://stackoverflow.com/a/71049728/1539100 but i do not find any useful result in Bing

thanks

答案1

得分: 3

这只是意味着,您在项目中创建了一个子文件夹。
查看解决方案资源管理器 - 您应该看到一个同名的文件夹。

英文:

This simply means, You have created a subfolder in your project.
Look in the Solution Explorer - You should see a folder with the same name.

“Folder tag” 在 csproj 中的意思是什么?

答案2

得分: 0

这是您项目的虚拟结构,不反映磁盘上的结构。通常,它用于在Visual Studio中构建解决方案。

英文:

This is the virtual structure of your project and does not mirror the structure on disk. Usually, it is used for structuring solutions in VS.

答案3

得分: 0

根据您问题的描述,我认为您希望官方文档对此进行澄清,是吗?

如果是这样的话,MSBuild文档根本没有详细说明这个问题。也许微软认为这个元素可以字面理解,所以没有解释它,但您可以在其他地方看到这个元素的作用:

Folder元素(Visual Studio项目模板中的VS工具扩展性)

正如它所提到的,它指定了要添加到项目的文件夹。

实际效果是将文件夹及其内容添加到VS项目UI中:

“Folder tag” 在 csproj 中的意思是什么?

顺便说一下,这个元素来自Microsoft.Build.Commontypes.xsd

您无法找到文档的困惑完全是因为缺少文档,文档应该出现在这里:

常见的MSBuild项目项

Folder元素确实应该在上述文档中说明,您可以从xsd定义中理解这一点。

您可以在此处反馈文档的缺失:

“Folder tag” 在 csproj 中的意思是什么?

英文:

From the description of your question, I think you want the official document to clarify this, right?

If so, The MSBuild documentation does not write this thing at all. Maybe Microsoft thinks this element can be understood literally, so it has not explained it, but you can see the role of this Element elsewhere:

Folder element (Visual Studio project templates) in VS Tools Extensionbility

As it mentioned, Specifies a folder that will be added to the project.

The actual effect is add folder and it's contents to VS project UI:

“Folder tag” 在 csproj 中的意思是什么?


By the way, this element comes from Microsoft.Build.Commontypes.xsd.

The confusion you're experiencing with not being able to find documentation is entirely due to missing documentation, which should appear here:

Common MSBuild project items

Folder element should indeed be stated in the above document, you can understand this from the xsd definition.

You can feedback the document lack here:

“Folder tag” 在 csproj 中的意思是什么?

huangapple
  • 本文由 发表于 2023年3月3日 21:14:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627545.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定