<None Remove="..." 是什么意思?/>在 csproj 中是什么意思? [英] What does <None Remove="..." /> mean in csproj?

查看:72
本文介绍了<None Remove="..." 是什么意思?/>在 csproj 中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 dotnet core csproj,并且添加了一个新文件.由于约定优于配置,它最初根本没有添加到 csproj 中.但是,一旦我将其构建操作从无更改为嵌入式资源,就会将两个条目写入 csproj 文件:

I'm working with a dotnet core csproj and I've added a new file. It doesn't initially get added to the csproj at all because of convention over configuration. But as soon as I change its Build Action from None to Embedded resource, two entries are written to the csproj file:

<None Remove="MyFile.sql" />

<EmbeddedResource Include="MyFile.sql" />

第一个条目是什么意思?这对我来说似乎是多余的.

What does that first entry mean? It seems superfluous to me.

推荐答案

sdk 风格的项目有一些自动包含.

The sdk-style projects have a few automatic includes.

默认情况下,sdk 具有类似 <None Include="**/*">(简化)的内容,它添加(包含)在您的项目内容之前.但是您不希望您的文件位于None"集中,而是位于EmbeddedResource"集中.

By default, the sdk has something like <None Include="**/*"> (simplified) that is added (included) before your project's contents. But you don't want your file to be in the "None" set, but in the "EmbeddedResource" set.

MSBuild 文件在多个项目组中没有任何问题,但它应该只在一个项目组中,以免 IDE 混淆(并且仅显示一次文件以显示正确的构建操作).

MSBuild doesn't have any problem with the files being in more than one item group, but it should only be in one so IDEs don't get confused (and display the file only once an show the correct build action).

所以这两个语句的意思是将它从 None 集(项)中移除,并将其添加到 EmbeddedResource 集(项)中".

So the two statements mean "remove it from the None set (items) and add it to the EmbeddedResource set (items)".

这篇关于&lt;None Remove="..." 是什么意思?/&gt;在 csproj 中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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