Skip to content

Watch .slnx solution files as well as .sln - #51

Open
xperiandri wants to merge 2 commits into
mrlacey:mainfrom
xperiandri:slnx-solution-watcher
Open

xperiandri wants to merge 2 commits into
mrlacey:mainfrom
xperiandri:slnx-solution-watcher

Conversation

@xperiandri

@xperiandri xperiandri commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

A solution in the .slnx format (the XML based solution format that the .NET SDK 9.0.200 and later and MSBuild 17.13 and later read) is not recognized by the extension as a solution file. For such a solution, a change of the solution file, such as adding a project, does not reload the list of .resx files. The watcher of the project files is not affected.

This pull request makes the watcher and the handler of renamed files accept .sln and .slnx, without regard to case, and adds nine tests for the new helper.

Cause, changes, things to know and verification

Cause

StringResVizPackage sets up the watcher of the solution file only when the name ends in .sln, and the handler of renamed files checks the same. For a .slnx solution that watcher is never set up.

Changes

  • StringExtensions.IsSolutionFileName recognizes the .sln and .slnx extensions, without regard to case.
  • WatchForSolutionOrProjectChanges and SlnWatcher_Renamed use it. The check in the rename handler compared case sensitively before and does not any more.
  • Nine tests for the helper in a new StringExtensionsTests class: both formats, different case, a project file, a solution filter, an extension in the middle of the path, an empty name and null.

Things to know

Verification

  • A full rebuild gives no errors and the same 26 distinct warnings as the code without the change. It was built with the MSBuild of Visual Studio 2026 and -p:TargetFrameworkVersion=v4.8, because the .NET Framework 4.8.1 targeting pack is not installed on the machine that prepared this change. All 13 tests pass: the 4 existing ones and the 9 new ones.
  • The extension was not run in the Experimental instance, so the watcher itself is not exercised by a test. To see it work, open a solution in the .slnx format and change the solution file (for example by adding a project): the "String Resource Visualizer" pane of the Output window should then show "Reloading list of resx files.".
  • CI: the workflow of this repository waits for the approval of a maintainer on this pull request. The same branch ran in a fork (Build). The build, with the .NET Framework 4.8.1 targeting pack of the runner, and the test step succeed. The step Publish Test Results then fails, because the third-party action EnricoMi/publish-unit-test-result-action/windows@v2 finds no Python interpreter on the windows-2022 image (No python3 interpreter found); it fails in the same way on the unchanged code of main (run in the fork), so this change does not cause it.

🤖 Generated with Claude Code

xperiandri and others added 2 commits October 26, 2026 19:29
The watcher of the solution file was set up only when the name of the solution ended in ".sln",
and its rename handler checked the same. A solution in the newer, XML based, .slnx format got no
watcher, so a change of the solution (such as adding a project) did not reload the list of .resx
files. The project file watcher was not affected.

IsSolutionFileName recognizes both extensions, without regard to case, and both checks use it.
The check in the rename handler was case sensitive before and is not any more.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Nine tests for IsSolutionFileName: the .sln and .slnx formats, different case, a project file and a
solution filter, an extension in the middle of the path, an empty name and null.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant