Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my C# project file have no Compile Inlcude elements for source files

I ported a library targeting the .NET Framework to a .NET Standard 2.0 library. The two project files (.NET Framework library and the .NET Standard library) are in the same folder and share most of the source code. Everything is working well.

Recently, I added a new class to both projects. When I look at the .NET Standard project file in a text editor I see there are no source file includes (Compile Include="). It appears to just pick up the files from the project folder and subfolders. The only source file entries in the project file are Compile Remove= entries for source files that are not needed.

Even when I add a source file to the project from the project folder, no new Compile Include element is added to the project file, yet the new file is present in Solution Explorer.

Is this normal? The .NET Framework project has a Compile Include elements for all the source files it uses.

like image 358
dheinz Avatar asked Mar 04 '23 15:03

dheinz


1 Answers

Is this normal?

Yes. "SDK style" projects end up being much more compact due to the default includes and excludes for compile items and embedded resources. No more merge conflicts with your colleagues due to both of you adding a C# file etc.

It's a thoroughly good thing.

like image 51
Jon Skeet Avatar answered May 01 '23 06:05

Jon Skeet