diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 42eec33987..5713f5be3d 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -22,10 +22,11 @@ + - + diff --git a/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj b/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj index d93d7009bb..f54b1f214b 100644 --- a/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj +++ b/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj @@ -6,12 +6,17 @@ true en true + $(NoWarn);CS8669 + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs deleted file mode 100644 index a1f589114f..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable - -#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP2X - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Link = System.ComponentModel.DescriptionAttribute; - -/// -/// Indicates that a parameter captures the expression passed for another parameter as a string. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage(AttributeTargets.Parameter)] -[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callerargumentexpressionattribute")] -#if PolyPublic -public -#endif -sealed class CallerArgumentExpressionAttribute : - Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// - /// The name of the parameter whose expression should be captured as a string. - /// - public CallerArgumentExpressionAttribute(string parameterName) => - ParameterName = parameterName; - - /// - /// Gets the name of the parameter whose expression should be captured as a string. - /// - public string ParameterName { get; } -} - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs deleted file mode 100644 index 37cf5ccc71..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Link = System.ComponentModel.DescriptionAttribute; - -/// -/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: AttributeTargets.All, - AllowMultiple = true, - Inherited = false)] -[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.compilerfeaturerequiredattribute")] -#if PolyPublic -public -#endif -sealed class CompilerFeatureRequiredAttribute : - Attribute -{ - /// - /// Initialize a new instance of - /// - /// The name of the required compiler feature. - public CompilerFeatureRequiredAttribute(string featureName) => - FeatureName = featureName; - - /// - /// The name of the compiler feature. - /// - public string FeatureName { get; } - - /// - /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand . - /// - public bool IsOptional { get; init; } - - /// - /// The used for the ref structs C# feature. - /// - public const string RefStructs = nameof(RefStructs); - - /// - /// The used for the required members C# feature. - /// - public const string RequiredMembers = nameof(RequiredMembers); -} - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs deleted file mode 100644 index f7221c6dda..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -#pragma warning disable - -#if !NET5_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; - -/// -/// Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -#if PolyPublic -public -#endif -static class IsExternalInit; - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs deleted file mode 100644 index 827063a13d..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -#pragma warning disable - -#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X - -namespace System.Diagnostics.CodeAnalysis; - -using Targets = AttributeTargets; - -/// -/// Specifies that an output is not even if the -/// corresponding type allows it. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: Targets.Field | - Targets.Parameter | - Targets.Property | - Targets.ReturnValue)] -#if PolyPublic -public -#endif -sealed class NotNullAttribute : - Attribute; -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs deleted file mode 100644 index a38ca389fd..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; - -using Targets = AttributeTargets; - -/// -/// Specifies that a type has required members or that a member is required. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: Targets.Class | - Targets.Struct | - Targets.Field | - Targets.Property, - Inherited = false)] -#if PolyPublic -public -#endif -sealed class RequiredMemberAttribute : - Attribute; -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs deleted file mode 100644 index a3cdfc8608..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Diagnostics.CodeAnalysis; - -/// -/// Specifies that this constructor sets all required members for the current type, and callers -/// do not need to set any required members themselves. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage(AttributeTargets.Constructor)] -#if PolyPublic -public -#endif -sealed class SetsRequiredMembersAttribute : - Attribute; -#endif diff --git a/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs b/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs index ce2fa4fd75..46f0b16b77 100644 --- a/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs +++ b/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs @@ -15,7 +15,7 @@ namespace {{GeneratedNamespaceName}}; public class {{Model.CommandTypeName}}Impl : Command, ICommandImpl { public string CommandImplName => nameof({{Model.CommandTypeName}}Impl); - {{- if (Model.ParentCommand | string.empty) }} + {{- if (Model.ParentCommand == null || Model.ParentCommand == "") }} public string ParentCommandImplName => string.Empty; {{- else }} public string ParentCommandImplName => nameof({{Model.ParentCommand}}Impl);