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" />
and
<EmbeddedResource Include="MyFile.sql" />
What does that first entry mean? It seems superfluous to me.
None - The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file. Content - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .
Right-click on the project (tagged as unavailable in solution explorer) and click "Edit yourproj. csproj". This will open up your CSPROJ file for editing. After making the changes you want, save, and close the file.
CSPROJ files define a project's content, platform requirements, versioning information, and web server or database server settings. They also list the files that are part of the project.
I think what i have concluded is that the CSPROJ and SLN files do not get checked into TFS and must be manually passed to each developer when they initially get latest from TFS.
The sdk-style projects have a few automatic includes.
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 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).
So the two statements mean "remove it from the None set (items) and add it to the EmbeddedResource set (items)".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With