From 78b7459a71dd052a329d103e4773be24db2ea604 Mon Sep 17 00:00:00 2001 From: Timothy Makkison Date: Thu, 7 Nov 2024 20:25:54 +0000 Subject: [PATCH] fix: support - symbols in csproj names --- InterfaceStubGenerator.Shared/Parser.cs | 2 +- Refit/UniqueName.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InterfaceStubGenerator.Shared/Parser.cs b/InterfaceStubGenerator.Shared/Parser.cs index a603d7a6f..b1315ab77 100644 --- a/InterfaceStubGenerator.Shared/Parser.cs +++ b/InterfaceStubGenerator.Shared/Parser.cs @@ -265,7 +265,7 @@ bool nullableEnabled } // Remove dots - ns = ns!.Replace(".", ""); + ns = ns!.Replace(".", "").Replace('-', '_'); var interfaceDisplayName = interfaceSymbol.ToDisplayString( SymbolDisplayFormat.FullyQualifiedFormat ); diff --git a/Refit/UniqueName.cs b/Refit/UniqueName.cs index 0fc7e85f9..fafb23acc 100644 --- a/Refit/UniqueName.cs +++ b/Refit/UniqueName.cs @@ -39,7 +39,7 @@ public static string ForType(Type refitInterfaceType) interfaceTypeName = interfaceTypeName.Replace("+", ""); // Get the namespace and remove the dots - var ns = refitInterfaceType.Namespace?.Replace(".", ""); + var ns = refitInterfaceType.Namespace?.Replace(".", "").Replace("-", "_"); // Refit types will be generated as private classes within a Generated type in namespace // Refit.Implementation