Skip to content

Allow individual project to override the default LangVersion settings #37498

Closed
@cshung

Description

@cshung

Because of our collaboration with ILSpy, we need to make sure ILCompiler.Reflection.ReadyToRun do not use C# features that are not available in C# 7.3

This problem is not particularly severe, we had it just a couple of times in the past, such as #32460, or #37451.

It would be nice if we could fix the build so that the offending of that rule is caught at build time. However, because of a forceful setting in

<LangVersion>preview</LangVersion>

Make overriding the LangVersion in ILCompiler.Reflection.ReadyToRun.csproj does not work.

It is possible to fix by introducing a LangVersionOverride like this:

    <LangVersion Condition="'$(LangVersionOverride)' == ''">preview</LangVersion>
    <LangVersion Condition="'$(LangVersionOverride)' != ''">$(LangVersionOverride)</LangVersion>

Not being an MSBuild expert, I don't know what is the best practice.

This issue is meant to leave this problem to the experts.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions