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

1

5

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.

Folketing answered 30/7, 2019 at 15:18 Comment(0)
I
7

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.

Internalize answered 30/7, 2019 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.