Conversation
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove duplicated Visual Studio installation discovery logic
Centralize Visual Studio installation discovery in test infrastructure
Nov 13, 2025
T-Gro
reviewed
Nov 13, 2025
- Move AssemblyResolver logic to VSInstallDiscovery.fs as a new module - Update both AssemblyResolver.fs files to delegate to centralized implementation - Add VSInstallDiscovery.fs as linked file to Salsa project (fixes missing reference) - Reduces code duplication further (~70 lines total removed) Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
The AssemblyName.CodeBase property is deprecated but still needed for assembly resolution in VS integration tests. Suppress warning 44 in FSharp.Test.Utilities project. Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
Centralize Visual Studio installation discovery in test infrastructure
Centralize Visual Studio installation discovery and assembly resolution in test infrastructure
Nov 13, 2025
Contributor
✅ No release notes required |
T-Gro
approved these changes
Nov 14, 2025
T-Gro
requested changes
Nov 27, 2025
Member
T-Gro
left a comment
There was a problem hiding this comment.
@copilot :
Pls rename it to avoid conflicts.
D:\a_work\1\s\tests\FSharp.Test.Utilities\CompilerAssert.fs(32,8): error FS0248: Two modules named 'FSharp.Test.AssemblyResolver' occur in two parts of this assembly [D:\a_work\1\s\tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj::TargetFramework=net472]
D:\a_work\1\s\tests\FSharp.Test.Utilities\VSInstallDiscovery.fs(140,8): error FS0248: Two modules named 'FSharp.Test.AssemblyResolver' occur in two parts of this assembly [D:\a_work\1\s\tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj::TargetFramework=net472]
0 Warning(s)
2 Error(s)
Fixes FS0248 error: Two modules named 'FSharp.Test.AssemblyResolver' were occurring because CompilerAssert.fs already has an AssemblyResolver module. Renamed the new module to VSAssemblyResolver to avoid conflict. Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Contributor
Author
Member
|
/azp run |
T-Gro
approved these changes
Nov 27, 2025
|
Azure Pipelines successfully started running 2 pipeline(s). |
abonie
approved these changes
Dec 1, 2025
This was referenced Dec 2, 2025
This was referenced Dec 2, 2025
abonie
pushed a commit
to abonie/fsharp
that referenced
this pull request
Dec 11, 2025
…on in test infrastructure (dotnet#19085)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Consolidates VS installation discovery and assembly resolution logic scattered across test files. Four files had duplicate fallback code;
VsMocks.fshardcodedVS170COMNTOOLSinstead of using centralized discovery. TwoAssemblyResolver.fsfiles contained identical assembly resolution logic.Changes
Added to
VSInstallDiscovery.fs:getVSInstallDirOrFail()- fails with detailed error showing discovery methods attemptedVSAssemblyResolvermodule - centralizes assembly resolution logic for VS integration tests (named to avoid conflict with existingAssemblyResolvermodule inCompilerAssert.fs)Updated consumer files:
AssemblyResolver.fsfiles now delegate to centralizedFSharp.Test.VSAssemblyResolvermoduleVsMocks.fsuses centralized discovery via linkedVSInstallDiscovery.fsfilefun h args→fun _ args)Project structure changes:
VSInstallDiscovery.fsas linked file to Salsa project (avoids NuGet reference warnings)AssemblyName.CodeBaseproperty (still needed for assembly resolution)Impact
Checklist
Original prompt
Unify Visual Studio Installation Discovery Across Test Infrastructure
Overview
Currently, the codebase has Visual Studio installation discovery logic duplicated across multiple test files, with some files still hardcoding specific VS version environment variables (like
VS170COMNTOOLS). We have a centralizedVSInstallDiscovery.fsmodule that handles this properly, but not all files are using it correctly.Goals
Current Problems
VsMocks.fsstill hardcodesVS170COMNTOOLSinstead of using centralized discoveryFiles to Modify
1.
tests/FSharp.Test.Utilities/VSInstallDiscovery.fsAdd a new helper function at the end of the file (after the existing
getVSInstallDirWithLoggingfunction):This should be added after line 128 (after the
getVSInstallDirWithLoggingfunction).2.
vsintegration/tests/UnitTests/AssemblyResolver.fsReplace the entire file content with:
Key changes from original:
match tryGetVSInstallDir()...tolet vsInstallDir = getVSInstallDirOrFail ()fun h args ->tofun _ args ->(unused parameter)(probingPaths )→probingPaths3.
vsintegration/tests/FSharp.Editor.Tests/Helpers/AssemblyResolver.fsReplace the entire file content with: