diff --git a/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedAttribute.cs b/DNN Platform/DotNetNuke.Abstractions/DnnDeprecatedAttribute.cs similarity index 97% rename from DotNetNuke.Internal.SourceGenerators/DnnDeprecatedAttribute.cs rename to DNN Platform/DotNetNuke.Abstractions/DnnDeprecatedAttribute.cs index 34c16076cd2..82fa906c3b4 100644 --- a/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedAttribute.cs +++ b/DNN Platform/DotNetNuke.Abstractions/DnnDeprecatedAttribute.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information namespace DotNetNuke.Internal.SourceGenerators; +using System; using System.Diagnostics; /// Marks a type or member as deprecated. diff --git a/DNN Platform/DotNetNuke.Abstractions/DotNetNuke.Abstractions.csproj b/DNN Platform/DotNetNuke.Abstractions/DotNetNuke.Abstractions.csproj index 22d03f6d033..53304f6e1b6 100644 --- a/DNN Platform/DotNetNuke.Abstractions/DotNetNuke.Abstractions.csproj +++ b/DNN Platform/DotNetNuke.Abstractions/DotNetNuke.Abstractions.csproj @@ -9,6 +9,7 @@ true + latest diff --git a/DNN Platform/DotNetNuke.DependencyInjection/DotNetNuke.DependencyInjection.csproj b/DNN Platform/DotNetNuke.DependencyInjection/DotNetNuke.DependencyInjection.csproj index 7b39415f97d..f9d1437732c 100644 --- a/DNN Platform/DotNetNuke.DependencyInjection/DotNetNuke.DependencyInjection.csproj +++ b/DNN Platform/DotNetNuke.DependencyInjection/DotNetNuke.DependencyInjection.csproj @@ -36,7 +36,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 5dee4293bd2..54eebe2bdb1 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -82,10 +82,14 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators + + {6928a9b1-f88a-4581-a132-d3eb38669bb0} + DotNetNuke.Abstractions + diff --git a/DNN Platform/DotNetNuke.Web.Client/DotNetNuke.Web.Client.csproj b/DNN Platform/DotNetNuke.Web.Client/DotNetNuke.Web.Client.csproj index 5cbfd2d8173..d688d69ab26 100644 --- a/DNN Platform/DotNetNuke.Web.Client/DotNetNuke.Web.Client.csproj +++ b/DNN Platform/DotNetNuke.Web.Client/DotNetNuke.Web.Client.csproj @@ -104,10 +104,14 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators + + {6928a9b1-f88a-4581-a132-d3eb38669bb0} + DotNetNuke.Abstractions + diff --git a/DNN Platform/DotNetNuke.Web.Mvc/DotNetNuke.Web.Mvc.csproj b/DNN Platform/DotNetNuke.Web.Mvc/DotNetNuke.Web.Mvc.csproj index 4795fb10508..80c16e43efe 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/DotNetNuke.Web.Mvc.csproj +++ b/DNN Platform/DotNetNuke.Web.Mvc/DotNetNuke.Web.Mvc.csproj @@ -210,7 +210,7 @@ - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/DotNetNuke.Web.Razor/DotNetNuke.Web.Razor.csproj b/DNN Platform/DotNetNuke.Web.Razor/DotNetNuke.Web.Razor.csproj index 288962cd393..69872116ee2 100644 --- a/DNN Platform/DotNetNuke.Web.Razor/DotNetNuke.Web.Razor.csproj +++ b/DNN Platform/DotNetNuke.Web.Razor/DotNetNuke.Web.Razor.csproj @@ -137,7 +137,7 @@ - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/DotNetNuke.Web/DotNetNuke.Web.csproj b/DNN Platform/DotNetNuke.Web/DotNetNuke.Web.csproj index 3712b6d085f..f7c81bea150 100644 --- a/DNN Platform/DotNetNuke.Web/DotNetNuke.Web.csproj +++ b/DNN Platform/DotNetNuke.Web/DotNetNuke.Web.csproj @@ -438,7 +438,7 @@ - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/HttpModules/DotNetNuke.HttpModules.csproj b/DNN Platform/HttpModules/DotNetNuke.HttpModules.csproj index 1f60d1530bf..a9f293bcdf1 100644 --- a/DNN Platform/HttpModules/DotNetNuke.HttpModules.csproj +++ b/DNN Platform/HttpModules/DotNetNuke.HttpModules.csproj @@ -99,7 +99,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Library/DotNetNuke.Library.csproj b/DNN Platform/Library/DotNetNuke.Library.csproj index 3dbfd1f4f13..641837c2b71 100644 --- a/DNN Platform/Library/DotNetNuke.Library.csproj +++ b/DNN Platform/Library/DotNetNuke.Library.csproj @@ -1918,7 +1918,7 @@ - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Modules/DDRMenu/DotNetNuke.Modules.DDRMenu.csproj b/DNN Platform/Modules/DDRMenu/DotNetNuke.Modules.DDRMenu.csproj index ca0048ec83f..4caab8add31 100644 --- a/DNN Platform/Modules/DDRMenu/DotNetNuke.Modules.DDRMenu.csproj +++ b/DNN Platform/Modules/DDRMenu/DotNetNuke.Modules.DDRMenu.csproj @@ -227,7 +227,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj b/DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj index 433343ce99f..3a6541880e1 100644 --- a/DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj +++ b/DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj @@ -145,10 +145,14 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators + + {6928a9b1-f88a-4581-a132-d3eb38669bb0} + DotNetNuke.Abstractions + {3cd5f6b8-8360-4862-80b6-f402892db7dd} DotNetNuke.Instrumentation diff --git a/DNN Platform/Modules/HTML/DotNetNuke.Modules.Html.csproj b/DNN Platform/Modules/HTML/DotNetNuke.Modules.Html.csproj index 1d441b122cd..04a58d10c72 100644 --- a/DNN Platform/Modules/HTML/DotNetNuke.Modules.Html.csproj +++ b/DNN Platform/Modules/HTML/DotNetNuke.Modules.Html.csproj @@ -219,7 +219,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Modules/HtmlEditorManager/DotNetNuke.Modules.HtmlEditorManager.csproj b/DNN Platform/Modules/HtmlEditorManager/DotNetNuke.Modules.HtmlEditorManager.csproj index 12707f17588..eeaaeddccef 100644 --- a/DNN Platform/Modules/HtmlEditorManager/DotNetNuke.Modules.HtmlEditorManager.csproj +++ b/DNN Platform/Modules/HtmlEditorManager/DotNetNuke.Modules.HtmlEditorManager.csproj @@ -146,7 +146,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj b/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj index 1518cd30d96..e11eaa8eab2 100644 --- a/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj +++ b/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj @@ -174,7 +174,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj b/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj index a9f3f42cadc..4a4ad6b591f 100644 --- a/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj +++ b/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj @@ -195,7 +195,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/DNNConnect.CKEditorProvider.csproj b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/DNNConnect.CKEditorProvider.csproj index 65586b12c5f..f64d3da9f3d 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/DNNConnect.CKEditorProvider.csproj +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/DNNConnect.CKEditorProvider.csproj @@ -408,7 +408,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Tests/DNN.Integration.Test.Framework/DNN.Integration.Test.Framework.csproj b/DNN Platform/Tests/DNN.Integration.Test.Framework/DNN.Integration.Test.Framework.csproj index d9e898ee965..8d90a55ca36 100644 --- a/DNN Platform/Tests/DNN.Integration.Test.Framework/DNN.Integration.Test.Framework.csproj +++ b/DNN Platform/Tests/DNN.Integration.Test.Framework/DNN.Integration.Test.Framework.csproj @@ -115,10 +115,14 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators + + {6928a9b1-f88a-4581-a132-d3eb38669bb0} + DotNetNuke.Abstractions + {6b29aded-7b56-4484-bea5-c0e09079535b} DotNetNuke.Library diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/DnnDeprecatedGeneratorTests.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/DnnDeprecatedGeneratorTests.cs index 7e23ad4839c..afbf6d998d2 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/DnnDeprecatedGeneratorTests.cs +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/DnnDeprecatedGeneratorTests.cs @@ -318,7 +318,7 @@ private static async Task Verify(string source) AppDomain.CurrentDomain.GetAssemblies() .Where(a => !a.IsDynamic && !string.IsNullOrEmpty(a.Location)) .Select(a => MetadataReference.CreateFromFile(a.Location)) - .Append(MetadataReference.CreateFromFile(typeof(DnnDeprecatedAttribute).Assembly.Location)); + .Append(MetadataReference.CreateFromFile(typeof(DnnDeprecatedGenerator).Assembly.Location)); var compilation = CSharpCompilation.Create( "AnAssemblyName", new[] { CSharpSyntaxTree.ParseText(source), }, diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedExtensionMethod_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedExtensionMethod_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..474172b29dd --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedExtensionMethod_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..474172b29dd --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithOptionalParameters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithOptionalParameters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..474172b29dd --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithOptionalParameters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithParamsParameter_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithParamsParameter_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..474172b29dd --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethodWithParamsParameter_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethods_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethods_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..474172b29dd --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedMethods_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedGenericPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNestedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNonPartialClass_ReportsAnErrorDiagnostic#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNonPartialClass_ReportsAnErrorDiagnostic#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedNonPartialClass_ReportsAnErrorDiagnostic#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialClass_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialGenericInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialGenericInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialGenericInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialInterface_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialRecord_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialStruct_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialStruct_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedPartialStruct_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedWithSpecialCharacters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedWithSpecialCharacters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.DeprecatedWithSpecialCharacters_AddsPartialWithObsoleteAttribute#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.NotDeprecatedClass_DoesNotGenerateAnything#DnnDeprecatedAttribute.g.verified.cs b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.NotDeprecatedClass_DoesNotGenerateAnything#DnnDeprecatedAttribute.g.verified.cs new file mode 100644 index 00000000000..c8549271f3e --- /dev/null +++ b/DNN Platform/Tests/DotNetNuke.Tests.SourceGenerators/Snapshots/DnnDeprecatedGeneratorTests.NotDeprecatedClass_DoesNotGenerateAnything#DnnDeprecatedAttribute.g.verified.cs @@ -0,0 +1,39 @@ +//HintName: DnnDeprecatedAttribute.g.cs +namespace DotNetNuke.Internal.SourceGenerators; + +using System; +using System.Diagnostics; + +/// Marks a type or member as deprecated. +[Conditional("DNN_SOURCE_GENERATOR")] +internal class DnnDeprecatedAttribute : Attribute +{ + /// Initializes a new instance of the class. + /// The major version in which the type or member was deprecated. + /// The minor version in which the type or member was deprecated. + /// The patch version in which the type or member was deprecated. + /// The suggested replacement or alternative. + public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + /// Gets the major version in which the type or member was deprecated. + public int MajorVersion { get; } + + /// Gets the minor version in which the type or member was deprecated. + public int MinorVersion { get; } + + /// Gets the patch version in which the type or member was deprecated. + public int PatchVersion { get; } + + /// Gets the suggested replacement or alternative. + public string Replacement { get; } + + /// Gets or sets the major version in which the type or member will be removed. + public int RemovalVersion { get; set; } +} \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Utilities/DotNetNuke.Tests.Utilities.csproj b/DNN Platform/Tests/DotNetNuke.Tests.Utilities/DotNetNuke.Tests.Utilities.csproj index 1db32b14203..41c136137c8 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Utilities/DotNetNuke.Tests.Utilities.csproj +++ b/DNN Platform/Tests/DotNetNuke.Tests.Utilities/DotNetNuke.Tests.Utilities.csproj @@ -136,7 +136,7 @@ - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/DNN Platform/Website/DotNetNuke.Website.csproj b/DNN Platform/Website/DotNetNuke.Website.csproj index f59bfd4579d..7247bf427b5 100644 --- a/DNN Platform/Website/DotNetNuke.Website.csproj +++ b/DNN Platform/Website/DotNetNuke.Website.csproj @@ -3413,7 +3413,7 @@ - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj index 3e78a7565ee..d035508f6eb 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj @@ -627,7 +627,7 @@ {6b29aded-7b56-4484-bea5-c0e09079535b} DotNetNuke.Library - + {5FE5D021-9C8D-47A6-BD34-F328BA3E709C} DotNetNuke.Internal.SourceGenerators diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Dnn.PersonaBar.Library.csproj b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Dnn.PersonaBar.Library.csproj index 7ab0e46fc48..cd6821f1447 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Dnn.PersonaBar.Library.csproj +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Dnn.PersonaBar.Library.csproj @@ -145,7 +145,7 @@ {6b29aded-7b56-4484-bea5-c0e09079535b} DotNetNuke.Library - + {5fe5d021-9c8d-47a6-bd34-f328ba3e709c} DotNetNuke.Internal.SourceGenerators diff --git a/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedGenerator.cs b/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedGenerator.cs index aa81d7599ff..42434523eef 100644 --- a/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedGenerator.cs +++ b/DotNetNuke.Internal.SourceGenerators/DnnDeprecatedGenerator.cs @@ -11,7 +11,7 @@ namespace DotNetNuke.Internal.SourceGenerators; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -/// A source generator which turns into . +/// A source generator which turns DnnDeprecatedAttribute into . [Generator] public class DnnDeprecatedGenerator : IIncrementalGenerator { @@ -461,7 +461,7 @@ private static bool ReportDiagnosticIfNotPartial(SourceProductionContext context return true; } - private static DnnDeprecatedAttribute? GetDeprecation(ISymbol typeSymbol, ISymbol dnnDeprecatedType) + private static DnnDeprecation? GetDeprecation(ISymbol typeSymbol, ISymbol dnnDeprecatedType) { foreach (var attribute in typeSymbol.GetAttributes()) { @@ -479,7 +479,7 @@ private static bool ReportDiagnosticIfNotPartial(SourceProductionContext context } } - var deprecation = new DnnDeprecatedAttribute( + var deprecation = new DnnDeprecation( (int)args[0].Value!, (int)args[1].Value!, (int)args[2].Value!, @@ -487,7 +487,7 @@ private static bool ReportDiagnosticIfNotPartial(SourceProductionContext context foreach (var arg in attribute.NamedArguments) { - if (!arg.Key.Equals(nameof(DnnDeprecatedAttribute.RemovalVersion), StringComparison.Ordinal)) + if (!arg.Key.Equals("RemovalVersion", StringComparison.Ordinal)) { continue; } @@ -568,4 +568,26 @@ private static bool HasAttribute(SyntaxNode node, CancellationToken token) return null; } + + private class DnnDeprecation + { + public DnnDeprecation(int majorVersion, int minorVersion, int patchVersion, string replacement) + { + this.MajorVersion = majorVersion; + this.MinorVersion = minorVersion; + this.PatchVersion = patchVersion; + this.Replacement = replacement; + this.RemovalVersion = majorVersion + 2; + } + + public int MajorVersion { get; } + + public int MinorVersion { get; } + + public int PatchVersion { get; } + + public string Replacement { get; } + + public int RemovalVersion { get; set; } + } }