From 4da215ef814045fb65216ea1bcb03cbbc025c77d Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Fri, 29 Nov 2024 14:39:02 +0100 Subject: [PATCH] Fixing the relative path of Orchard.Core and Orchard.Framework in the generated test project --- .../Commands/CodeGenerationCommands.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs index ea98f5883..398617a25 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs @@ -170,7 +170,7 @@ namespace Orchard.CodeGeneration.Commands { csprojText = csprojText.Replace("$$ProjectName$$", projectName); csprojText = csprojText.Replace("$$TestsProjectGuid$$", projectGuid); csprojText = csprojText.Replace("$$FileIncludes$$", itemGroup ?? ""); - csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences()); + csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences(modulesFolderRelativeDepth: 3)); File.WriteAllText(testsPath + projectName + ".csproj", csprojText); @@ -329,15 +329,17 @@ namespace Orchard.CodeGeneration.Commands { return text; } - private static string GetOrchardReferences() { + private static string GetOrchardReferences(int modulesFolderRelativeDepth = 2) { + var frameworkRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth + 1)); + var coreRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth)); return IsSourceEnlistment() ? -@" - {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} +$@" + {{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}} Orchard.Framework $(MvcBuildViews) - - {9916839C-39FC-4CEB-A5AF-89CA7E87119F} + + {{9916839C-39FC-4CEB-A5AF-89CA7E87119F}} Orchard.Core $(MvcBuildViews) " :