diff --git a/src/Persistence/SourceGenerator/MUnique.OpenMU.Persistence.SourceGenerator.csproj b/src/Persistence/SourceGenerator/MUnique.OpenMU.Persistence.SourceGenerator.csproj index b04bb1904..dcf2c61fe 100644 --- a/src/Persistence/SourceGenerator/MUnique.OpenMU.Persistence.SourceGenerator.csproj +++ b/src/Persistence/SourceGenerator/MUnique.OpenMU.Persistence.SourceGenerator.csproj @@ -16,6 +16,7 @@ + diff --git a/src/SourceGenerators/CloneableGenerator.cs b/src/SourceGenerators/CloneableGenerator.cs index c0c50ada1..84792d795 100644 --- a/src/SourceGenerators/CloneableGenerator.cs +++ b/src/SourceGenerators/CloneableGenerator.cs @@ -9,7 +9,6 @@ namespace MUnique.OpenMU.SourceGenerators; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; -using MUnique.OpenMU.Annotations; /// /// A which implements @@ -18,6 +17,10 @@ namespace MUnique.OpenMU.SourceGenerators; [Generator] public class CloneableGenerator : ISourceGenerator { + private const string CloneableAttributeFullName = "MUnique.OpenMU.Annotations.CloneableAttribute"; + + private const string CloneableAttributeName = "CloneableAttribute"; + /// public void Initialize(GeneratorInitializationContext context) { @@ -27,7 +30,7 @@ public void Initialize(GeneratorInitializationContext context) /// public void Execute(GeneratorExecutionContext context) { - var attributeSymbol = context.Compilation.GetTypeByMetadataName(typeof(CloneableAttribute).FullName); + var attributeSymbol = context.Compilation.GetTypeByMetadataName(CloneableAttributeFullName); var classWithAttributes = context.Compilation.SyntaxTrees.Where(st => st.GetRoot().DescendantNodes().OfType() .Any(p => p.DescendantNodes().OfType().Any())); @@ -80,7 +83,7 @@ private StringBuilder GeneratePartialClass(ClassDeclarationSyntax annotatedClass var sb = new StringBuilder(); var className = annotatedClass.Identifier.Text; var ns = declaredClassSymbol.ContainingNamespace?.ToString() ?? string.Empty; - var isInheritedClonable = declaredClassSymbol.BaseType?.GetAttributes().Any(a => a.AttributeClass?.Name == nameof(CloneableAttribute)) ?? false; + var isInheritedClonable = declaredClassSymbol.BaseType?.GetAttributes().Any(a => a.AttributeClass?.Name == CloneableAttributeName) ?? false; sb.AppendLine($""" namespace {ns}; diff --git a/src/SourceGenerators/MUnique.OpenMU.SourceGenerators.csproj b/src/SourceGenerators/MUnique.OpenMU.SourceGenerators.csproj index ae104b632..b04f63db6 100644 --- a/src/SourceGenerators/MUnique.OpenMU.SourceGenerators.csproj +++ b/src/SourceGenerators/MUnique.OpenMU.SourceGenerators.csproj @@ -7,8 +7,8 @@ false enable nullable;CS4014;VSTHRD110;VSTHRD100 - true - true + true + true @@ -21,11 +21,4 @@ - - - - $(SolutionDir)\Annotations\bin\$(Configuration)\MUnique.OpenMU.Annotations.dll - - -