diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs
index 49fd4afb9bb..91874b8ac5c 100644
--- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs
+++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs
@@ -709,6 +709,127 @@ await TestDiscoveryAsync(
);
}
+ [Fact]
+ public async Task TestRepo_DirectDiscovery_Slnx()
+ {
+ var solutionPath = "solution.slnx";
+ await TestDiscoveryAsync(
+ experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
+ packages:
+ [
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net7.0"),
+ ],
+ workspacePath: "",
+ files: new[]
+ {
+ ("src/project.csproj", """
+
+
+ net7.0;net8.0
+
+
+
+
+
+
+ """),
+ ("Directory.Build.props", ""),
+ ("Directory.Packages.props", """
+
+
+ true
+ 9.0.1
+
+
+
+
+
+
+ """),
+ (solutionPath, """
+
+
+
+
+
+ """),
+ ("global.json", """
+ {
+ "sdk": {
+ "version": "6.0.405",
+ "rollForward": "latestPatch"
+ },
+ "msbuild-sdks": {
+ "My.Custom.Sdk": "5.0.0",
+ "My.Other.Sdk": "1.0.0-beta"
+ }
+ }
+ """),
+ (".config/dotnet-tools.json", """
+ {
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "microsoft.botsay": {
+ "version": "1.0.0",
+ "commands": [
+ "botsay"
+ ]
+ },
+ "dotnetsay": {
+ "version": "2.1.3",
+ "commands": [
+ "dotnetsay"
+ ]
+ }
+ }
+ }
+ """),
+ },
+ expectedResult: new()
+ {
+ Path = "",
+ Projects = [
+ new()
+ {
+ FilePath = "src/project.csproj",
+ TargetFrameworks = ["net7.0", "net8.0"],
+ Dependencies = [
+ new("Some.Package", "9.0.1", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
+ new("Some.Package", "9.0.1", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
+ ],
+ Properties = [
+ new("TargetFrameworks", "net7.0;net8.0", "src/project.csproj")
+ ],
+ ReferencedProjectPaths = [],
+ ImportedFiles = [
+ "../Directory.Build.props",
+ "../Directory.Packages.props",
+ ],
+ AdditionalFiles = [],
+ }
+ ],
+ GlobalJson = new()
+ {
+ FilePath = "global.json",
+ Dependencies = [
+ new("Microsoft.NET.Sdk", "6.0.405", DependencyType.MSBuildSdk),
+ new("My.Custom.Sdk", "5.0.0", DependencyType.MSBuildSdk),
+ new("My.Other.Sdk", "1.0.0-beta", DependencyType.MSBuildSdk),
+ ]
+ },
+ DotNetToolsJson = new()
+ {
+ FilePath = ".config/dotnet-tools.json",
+ Dependencies = [
+ new("microsoft.botsay", "1.0.0", DependencyType.DotNetTool),
+ new("dotnetsay", "2.1.3", DependencyType.DotNetTool),
+ ]
+ }
+ }
+ );
+ }
+
[Fact]
public async Task TestRepo_SolutionFileCasingMismatchIsResolved()
{
diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs
index fe1bdcd0aa9..d0359449e58 100644
--- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs
+++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs
@@ -1,6 +1,9 @@
+using System;
using System.Collections.Immutable;
+using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
+using System.Xml.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Definition;
@@ -201,6 +204,7 @@ private static ImmutableArray FindEntryPoints(string workspacePath)
switch (extension)
{
case ".sln":
+ case ".slnx":
case ".proj":
case ".csproj":
case ".fsproj":
@@ -232,6 +236,30 @@ private static ImmutableArray ExpandEntryPointsIntoProjects(IEnumerable<
filesToExpand.Push(project.AbsolutePath);
}
}
+ else if (extension == ".slnx")
+ {
+ var projects = XElement
+ .Load(candidateEntryPoint)
+ .Descendants("Project")
+ .Select(static x => x.Attribute("Path"))
+ .Where(static x => x is not null)
+ .Select(static x => (string)x!)
+ .Where(static x =>
+ x.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
+ x.EndsWith(".fsproj", StringComparison.OrdinalIgnoreCase) ||
+ x.EndsWith(".vbproj", StringComparison.OrdinalIgnoreCase));
+
+ foreach (var project in projects)
+ {
+ // keep this project and check for references
+ expandedProjects.Add(project);
+ IEnumerable referencedProjects = ExpandItemGroupFilesFromProject(project, "ProjectReference");
+ foreach (string referencedProject in referencedProjects)
+ {
+ filesToExpand.Push(referencedProject);
+ }
+ }
+ }
else if (extension == ".proj")
{
IEnumerable foundProjects = ExpandItemGroupFilesFromProject(candidateEntryPoint, "ProjectFile", "ProjectReference");