From dd05aca3708a6751551b70a8f7191fea8633ed48 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Sun, 4 Jun 2023 15:52:06 -0400 Subject: [PATCH] Bug Fix The project was using a newer version of Microsoft.CodeAnalysis.CSharp --- .../ServerDatabase.SourceGenerator.csproj | 4 ++-- ServerDatabase.SourceGenerator/TableRowGenerator.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ServerDatabase.SourceGenerator/ServerDatabase.SourceGenerator.csproj b/ServerDatabase.SourceGenerator/ServerDatabase.SourceGenerator.csproj index 2157e1f..5aa00f2 100644 --- a/ServerDatabase.SourceGenerator/ServerDatabase.SourceGenerator.csproj +++ b/ServerDatabase.SourceGenerator/ServerDatabase.SourceGenerator.csproj @@ -6,7 +6,7 @@ enable netstandard2.0 true - 1.0.0 + 1.0.1 Server Database Source Generator JacobTech @@ -16,7 +16,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/ServerDatabase.SourceGenerator/TableRowGenerator.cs b/ServerDatabase.SourceGenerator/TableRowGenerator.cs index 7f1050f..657f091 100644 --- a/ServerDatabase.SourceGenerator/TableRowGenerator.cs +++ b/ServerDatabase.SourceGenerator/TableRowGenerator.cs @@ -59,12 +59,14 @@ public class TableRowGenerator : ISourceGenerator this.CloseClass(generatedClass); context.AddSource($"{declaredClass.Identifier}_{relatedClass.Type.Name}.g.cs", SourceText.From(generatedClass.ToString(), Encoding.UTF8)); + //context.AddSource($"{declaredClass.Identifier}_{relatedClass.Type.Name}_goooddddd.g.cs", SourceText.From(generatedClass.ToString().Replace("partial ", "").Replace(declaredClass.Identifier.ToString(), declaredClass.Identifier.ToString() + "GODDD"), Encoding.UTF8)); } } } catch (Exception e) { - context.AddSource("teste.g.cs", SourceText.From(@$"using System; + context.AddSource("teste.g.cs", SourceText.From(@$"// +using System; namespace ServerDatabase.SourceGenerator.Generated {{ public class bobe @@ -81,13 +83,14 @@ namespace ServerDatabase.SourceGenerator.Generated string bad = prop.Type.ToString(); bad = bad.Replace("ServerDatabase.TableColumn<", ""); bad = bad.Remove(bad.LastIndexOf('>')); - builder.AppendLine($" public {bad} {prop.Name} {{ get; set; }}"); + builder.AppendLine($" public {bad} {prop.Name} {{ get; set; }}"); } private StringBuilder GenerateClass(string n, ClassDeclarationSyntax og) { StringBuilder sb = new StringBuilder(); - sb.Append(@$"using System; + sb.Append(@$"// +using System; namespace {n} {{