diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs index 50971480..02aacd42 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs @@ -254,15 +254,14 @@ private static bool PackageReferenceExists(string projectFilePath, string packag var package = PackageReference.GetVersionFromCentralPackageManagement(projectFilePath)? .FirstOrDefault(p => p.include == packageName); - - // Using XPath to search for the PackageReference with a specific Include attribute and Version child element - - return xDocument.XPathSelectElements( - $"//PackageReference[@Include='{packageName}']/Version[text()='{version}']").Any() - || - (xDocument.XPathSelectElements( + var hasWithVersion = xDocument.XPathSelectElements($"//PackageReference[@Include='{packageName}' and @Version='{version}']").Any(); + + var hasVersionInCentralPackageManagement = (xDocument.XPathSelectElements( $"//PackageReference[@Include='{packageName}']").Any() && package != null && package?.version == version); + + return hasWithVersion || hasVersionInCentralPackageManagement; + } private static void AddNuGetPackageReference(string projectPath, string packageName, string version = null) diff --git a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json index 47ad35ea..99ef86db 100644 --- a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json +++ b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json @@ -21,8 +21,12 @@ "workingDirectory": "C:\\W\\Develop\\gh\\ix-ax\\axsharp\\src\\AXSharp.connectors\\tests\\ax-test-project\\" }, "app-withref": { - "commandName": "Project", - "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen\\src\\.application\\app\\" + "commandName": "Project", + "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen.templates\\templates.simple\\app\\" + }, + "app-withref-cpm": { + "commandName": "Project", + "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen\\src\\templates.simple\\app\\" } } } \ No newline at end of file diff --git a/src/AXSharp.compiler/src/ixd/Options.cs b/src/AXSharp.compiler/src/ixd/Options.cs index 5e4f5321..f3851f9d 100644 --- a/src/AXSharp.compiler/src/ixd/Options.cs +++ b/src/AXSharp.compiler/src/ixd/Options.cs @@ -28,7 +28,7 @@ internal class Options : ICompilerOptions public bool NoDependencyUpdate { get; set; } [Option('p', "project-file", Required = false, Default = "", - HelpText = "Output project file")] + HelpText = "(ignored here)Output project file")] public string? ProjectFile { get; set; } } } diff --git a/src/AXSharp.compiler/src/ixr/Options.cs b/src/AXSharp.compiler/src/ixr/Options.cs index 8e7bec74..c78419f6 100644 --- a/src/AXSharp.compiler/src/ixr/Options.cs +++ b/src/AXSharp.compiler/src/ixr/Options.cs @@ -18,11 +18,11 @@ internal class Options : ICompilerOptions [Option('o', "output-project-folder", Required = false, HelpText = "Output project folder where compiler emits result.")] public string? OutputProjectFolder { get; set; } - [Option('p', "project-file", Required = false, Default = false, + [Option('p', "project-file", Required = false, Default = "", HelpText = "Output project file")] public string? ProjectFile { get; set; } - [Option('b', "use-base-symbol", Required = false, Default = "", + [Option('b', "use-base-symbol", Required = false, Default = false, HelpText = "Will use base symbol in inherited types")] public bool UseBase { get; set; } diff --git a/src/AXSharp.compiler/src/ixr/Properties/launchSettings.json b/src/AXSharp.compiler/src/ixr/Properties/launchSettings.json index b82ca125..0b7fb692 100644 --- a/src/AXSharp.compiler/src/ixr/Properties/launchSettings.json +++ b/src/AXSharp.compiler/src/ixr/Properties/launchSettings.json @@ -6,6 +6,10 @@ }, "Profile 1": { "commandName": "Project" + }, + "app-withref": { + "commandName": "Project", + "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen.templates\\templates.simple\\app\\" } } } \ No newline at end of file