Skip to content

FSharp.workspacePath does not recognize .slnx solution files #2174

Description

@sangkilc

Describe the bug

FSharp.workspacePath currently treats only .sln files as solution files.

If FSharp.workspacePath is set to a .slnx path, Ionide does not load it as a solution workspace. It falls through to the directory path branch instead, so the configured workspace is ignored or misinterpreted.

There are also a couple of related .sln-only code paths:

  • extension activation uses workspaceContains:**/*.sln
  • the MSBuild solution watcher listens only to **/*.sln

Steps to reproduce

  1. Create a minimal repro workspace with two F# projects and two .slnx solution files:
dotnet new classlib -lang F# -n p1
dotnet new classlib -lang F# -n p2
dotnet new sln -n p1
dotnet new sln -n p2
dotnet sln p1.slnx add p1
dotnet sln p2.slnx add p2
mkdir .vscode
echo '{ "FSharp.workspacePath": "p2.slnx" }' > .vscode/settings.json
  1. Open that folder in VS Code.
  2. Reload the VS Code window if needed.
  3. Observe that Ionide does not reliably honor the configured p2.slnx path and falls back to general workspace discovery / solution selection behavior instead.

Expected behaviour

Ionide should treat .slnx the same way it treats .sln for:

  • FSharp.workspacePath parsing
  • matching the configured workspace against discovered solution candidates
  • solution file watching

Machine infos

  • OS: Windows/Mac/Linux
  • .NET SDK version: 10.0.301
  • Ionide version: latest

Minimal patch

diff --git a/release/package.json b/release/package.json
index 6581bea..f2a90d9 100644
--- a/release/package.json
+++ b/release/package.json
@@ -12,7 +12,7 @@
     "workspaceContains:**/*.fs",
     "workspaceContains:**/*.fsproj",
     "workspaceContains:**/*.fsx",
-    "workspaceContains:**/*.sln"
+    "workspaceContains:**/*.{sln,slnx}"
   ],
   "badges": [
     {
diff --git a/src/Components/MSBuild.fs b/src/Components/MSBuild.fs
index 5c68504..471e915 100644
--- a/src/Components/MSBuild.fs
+++ b/src/Components/MSBuild.fs
@@ -471,7 +471,7 @@ module MSBuild =
 
         let initWorkspace _n = Project.initWorkspace ()
 
-        let solutionWatcher = workspace.createFileSystemWatcher (U2.Case1 "**/*.sln")
+        let solutionWatcher = workspace.createFileSystemWatcher (U2.Case1 "**/*.{sln,slnx}")
 
         solutionWatcher.onDidCreate.Invoke(fun n -> unlessIgnored n.fsPath initWorkspace |> unbox)
         |> ignore
diff --git a/src/Core/Project.fs b/src/Core/Project.fs
index c9c2e3a..b85be4c 100644
--- a/src/Core/Project.fs
+++ b/src/Core/Project.fs
@@ -319,8 +319,9 @@ module Project =
 
         let private parse (value: string) =
             let fullPath = node.path.resolve (workspace.rootPath.Value, value)
+            let lowerValue = value.ToLowerInvariant()
 
-            if value.ToLowerInvariant().EndsWith(".sln") then
+            if lowerValue.EndsWith(".sln") || lowerValue.EndsWith(".slnx") then
                 ConfiguredWorkspace.Solution fullPath
             else
                 ConfiguredWorkspace.Directory fullPath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions