-
Notifications
You must be signed in to change notification settings - Fork 392
added conditional processing for C# language features based on languageVersion / framework #3454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8712c66
to
91c3cd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll review later. Suggested a naming change.
The other comment does not require action at present.
...ojectTemplates.6.0/content/ClassLibrary-CSharp/.template.config/csharpFeatures.template.json
Outdated
Show resolved
Hide resolved
@@ -5,7 +5,8 @@ | |||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework> | |||
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.ClassLibrary1</RootNamespace> | |||
<LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion> | |||
<Nullable Condition="('$(Framework)' != 'netstandard2.0')">enable</Nullable> | |||
<DisableImplicitNamespaceImports Condition="'$(csharpFeature_GlobalUsings_Supported)' != 'true'">true</DisableImplicitNamespaceImports> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the other thing I was going to comment on. If we need this, it's a bug in the feature - if we aren't where implicit usings are supported, they should not need to be disabled.
However, let's get Preview 7 out working correctly (correctly being you can run templates and they then compile), so if this is needed today, please leave it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it when language version is < 10.0, otherwise it won't compile.
91c3cd4
to
8f49b9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked idea of "additionalConfigFiles" a lot, assuming it could be shared between Library and Console templates, since that is not the case, I would prefer if we don't use it to give us more time to rethink what to do with this un-documented feature...
...ed/Microsoft.DotNet.Common.ProjectTemplates.6.0/content/ConsoleApplication-CSharp/Program.cs
Outdated
Show resolved
Hide resolved
|
||
#endif | ||
#if (!csharpFeature_TopLevelProgram) | ||
namespace Company.ConsoleApplication1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning on duplicating this content for the file-scoped namespaces feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it yet, but I guess no. Top-level programs are supported since 9.0 and file scoped namespaces are supported since 10.0, so there should be no need as if top level program is not supported, file scoped namespaces won't be supported too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah of course, this is Program.cs
😄 👍
8f49b9d
to
80c10e6
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
36558ed
to
ba6184c
Compare
…geVersion / framework
ba6184c
to
96afd02
Compare
Problem
fixes #3449
Solution
Added conditional processing for classlib / console based on framework and language versions:
target-framework-override
option (option is hidden from user)latest
,default
,latestMajor
,preview
language versions support all the features.Checks: