Skip to content

Convert sln to slnx #115818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 22, 2025
Merged

Convert sln to slnx #115818

merged 6 commits into from
May 22, 2025

Conversation

kasperk81
Copy link
Contributor

fixes #93878

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 21, 2025
@kasperk81
Copy link
Contributor Author

kasperk81 commented May 21, 2025

@ViktorHofer, @edvilme converted with command:
git ls-files '*.sln' | xargs -I{} ./dotnet.sh sln {} migrate

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 21, 2025
@ViktorHofer
Copy link
Member

We are still missing slngen support for slnx to update all checked in solution files.

@kasperk81
Copy link
Contributor Author

Is there an ETA? There is no activity in months microsoft/slngen#644.

@ViktorHofer
Copy link
Member

We can do slngen -> sln -> slnx. That logic is in slngen.proj.

@kasperk81
Copy link
Contributor Author

slngen is broken on main. it needs an update to recognize net10. after updating to "version": "12.0.15", it produces diffs like:

diff --git a/src/libraries/Microsoft.Bcl.AsyncInterfaces/Microsoft.Bcl.AsyncInterfaces.sln b/src/libraries/Microsoft.Bcl.AsyncInterfaces/Microsoft.Bcl.AsyncInterfaces.sln
index 580c63b466b..b185f83b4af 100644
--- a/src/libraries/Microsoft.Bcl.AsyncInterfaces/Microsoft.Bcl.AsyncInterfaces.sln
+++ b/src/libraries/Microsoft.Bcl.AsyncInterfaces/Microsoft.Bcl.AsyncInterfaces.sln
@@ -25,13 +25,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{85204CF5-0C8
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{D6A9108E-553B-445E-A037-FA4F3140A279}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "tools\gen", "{F4939A3B-3316-4166-8AE6-34E1D0863CF5}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools\gen", "tools\gen", "{F4939A3B-3316-4166-8AE6-34E1D0863CF5}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "tools\src", "{1AC9674D-927D-49C4-BB42-6FF353C84275}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools\src", "tools\src", "{1AC9674D-927D-49C4-BB42-6FF353C84275}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "tools\ref", "{670FB605-56DB-45F0-9B48-F8A62AFE5BD9}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{8F627B90-170F-4BCE-A626-7688EC714FB4}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools\ref", "tools\ref", "{670FB605-56DB-45F0-9B48-F8A62AFE5BD9}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -91,12 +89,9 @@ Global
                {D0F1936C-CF7C-4448-9F90-B9DEABE89EBB} = {D6A9108E-553B-445E-A037-FA4F3140A279}
                {59CE8DDB-AFFD-4C6F-B09F-94DE4DD0AAEA} = {F4939A3B-3316-4166-8AE6-34E1D0863CF5}
                {0225750F-4DC0-4C71-9B33-314ACA0EF682} = {F4939A3B-3316-4166-8AE6-34E1D0863CF5}
-               {F4939A3B-3316-4166-8AE6-34E1D0863CF5} = {8F627B90-170F-4BCE-A626-7688EC714FB4}
                {272C69D8-6BED-4CE0-BD62-9F993989374E} = {1AC9674D-927D-49C4-BB42-6FF353C84275}
                {FCA0C2EA-4A82-4B3F-A9B5-E0B5200866BF} = {1AC9674D-927D-49C4-BB42-6FF353C84275}
-               {1AC9674D-927D-49C4-BB42-6FF353C84275} = {8F627B90-170F-4BCE-A626-7688EC714FB4}
                {9957B23B-3C95-4200-A6D9-F05BAF6DC7A7} = {670FB605-56DB-45F0-9B48-F8A62AFE5BD9}
-               {670FB605-56DB-45F0-9B48-F8A62AFE5BD9} = {8F627B90-170F-4BCE-A626-7688EC714FB4}
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
                SolutionGuid = {A835CEDB-E9E2-49EE-8499-BD7FDD984E53}

which fails dotnet sln migrate:

One or more errors occurred. (One or more errors occurred. (Project name 'Mono.Linker' already exists in the 'Root' solution folder.))

the error is correct, new slngen has introduced this bug.

@ViktorHofer
Copy link
Member

Any idea which commit in slngen regressed this?

@kasperk81
Copy link
Contributor Author

Any idea which commit in slngen regressed this?

no idea. #105239 was an year ago but if you want to wait for slngen i will close this pr. #93878 doesn't say anything about slngen precondition

@kasperk81 kasperk81 closed this May 21, 2025
@ViktorHofer ViktorHofer reopened this May 22, 2025
@ViktorHofer
Copy link
Member

ViktorHofer commented May 22, 2025

@kasperk81 dotnet build src/libraries/slngen.proj works fine for me with these changes:

From fe4505215d43c0c13a43d3a7382a9ad88134dcb9 Mon Sep 17 00:00:00 2001
From: Viktor Hofer <viktor.hofer@microsoft.com>
Date: Thu, 22 May 2025 09:27:28 +0200
Subject: [PATCH] Add dotnet sln migrate command and update slngen

---
 .config/dotnet-tools.json |  2 +-
 src/libraries/slngen.proj | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index d5e70ab3de1..ac59f400004 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -21,7 +21,7 @@
       ]
     },
     "microsoft.visualstudio.slngen.tool": {
-      "version": "11.1.0",
+      "version": "12.0.15",
       "commands": [
         "slngen"
       ]
diff --git a/src/libraries/slngen.proj b/src/libraries/slngen.proj
index 3118a1e1545..c06b8c0e403 100644
--- a/src/libraries/slngen.proj
+++ b/src/libraries/slngen.proj
@@ -8,7 +8,8 @@
 
   <ItemGroup>
     <!-- Unless a "/p:SolutionNameOverride" property is passed in, glob all solutions under src/libraries. -->
-    <SolutionFile Include="$(MSBuildThisFileDirectory)$(SolutionNameOverride)\*.sln" />
+    <SolutionFile Include="$(MSBuildThisFileDirectory)$(SolutionNameOverride)\*.slnx"
+                  Exclude="$(MSBuildThisFileDirectory)Fuzzing\*.slnx" />
   </ItemGroup>
 
   <Target Name="UpdateSolutionFile"
@@ -25,12 +26,19 @@
 
     <!-- Delete temporary template file -->
     <Delete Files="%(SolutionFile.ProjFilePath)" />
+
+    <!-- Invoke dotnet sln migrate as slngen doesn't support slnx yet. -->
+    <Exec Command="&quot;$(RepoRoot)dotnet$(ScriptExt)&quot; sln migrate &quot;%(SolutionFile.SlnFilePath)&quot;" />
+
+    <!-- Delete the intermediate sln file. -->
+    <Delete Files="%(SolutionFile.SlnFilePath)" />
   </Target>
 
   <Target Name="GetSolutionFiles">
     <ItemGroup>
       <!-- Add attributes that require a separate item mutation. -->
-      <SolutionFile ProjFilePath="%(RelativeDir)%(Filename).proj" />
+      <SolutionFile ProjFilePath="%(RelativeDir)%(Filename).proj"
+                    SlnFilePath="%(RelativeDir)%(Filename).sln" />
     </ItemGroup>
   </Target>
 </Project>

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasperk81 thanks a lot for the hard work here. I think we can merge this as is and I will submit a follow-up PR with the slngen.proj changes.

@kasperk81
Copy link
Contributor Author

thanks @ViktorHofer. i checked Allow edits and access to secrets by maintainers so you can push here

@ViktorHofer
Copy link
Member

/ba-g failures are entirely unrelated as we don't build with slnxs. The other changes in this PR got successfully validated.

@ViktorHofer ViktorHofer merged commit bb48410 into dotnet:main May 22, 2025
157 of 162 checks passed
@kasperk81 kasperk81 deleted the slnx branch May 22, 2025 15:50
@@ -361,7 +361,7 @@ private static string GenerateLocalRunHelperScript(IFuzzer fuzzer)
private static void WorkaroundOneFuzzTaskNotAcceptingMultipleJobs(IFuzzer[] fuzzers)
{
string yamlPath = Environment.CurrentDirectory;
while (!File.Exists(Path.Combine(yamlPath, "DotnetFuzzing.sln")))
while (!File.Exists(Path.Combine(yamlPath, "DotnetFuzzing.slnx")))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misses sln in error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use slnx files instead of sln per library node
3 participants