RenniePet
RenniePet

Reputation: 11658

Why does a .csproj file in Roslyn solution not reference the C# files?

I'm starting to play around with Roslyn, and have run into a situation that I can't understand regarding how the Visual Studio solution that builds Roslyn works.

There is a C# project file named "CodeAnalysis.csproj". In my download from GitHub it is in file "E:\GitHub\dotnet\roslyn\src\Compilers\Core\Portable\CodeAnalysis.csproj". In the Visual Studio Solution Explorer it is at Compilers - Core - CodeAnalysis.

As far as I can see this project compiles hundreds of C# source files, most of them in about 30 sub-folders. But my problem is that I can't see anything in the .csproj file that indicates that it should compile all of these C# source files.

I'm guessing I'm missing something obvious, some new feature of .csproj files that implies "build everything in this folder and all sub-folders", but I just can't see it.

Upvotes: 0

Views: 718

Answers (1)

Oli
Oli

Reputation: 167

Yes you're missing something. This is a .net Standard project. These projects don't reference the included files but the excluded.

You can create a new .net Standard project and add classes. You will see, that the classes are not referenced in the .csproj file. If you're using Visual Studio, you can right click on a class in the Solution Explorer and choose "Exclude From Project" which will create a reference in the .csproj file with a remove attribute.

Upvotes: 2

Related Questions