Fix targetFramework detection incorrectly matching folder names containing "net" in deploy path#5021
Open
Copilot wants to merge 4 commits into
Open
Fix targetFramework detection incorrectly matching folder names containing "net" in deploy path#5021Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…atching TFMs within folder names Agent-Logs-Url: https://github.com/microsoft/vscode-azurefunctions/sessions/19007dbe-3fe6-4e77-8e34-ed5bf16fbc3d Co-authored-by: nturinski <5290572+nturinski@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Azure Functions extension config parsing issue
Fix targetFramework regex incorrectly matching folder names containing "net" in deploy path
May 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens .NET target framework detection in VS Code config verification to reduce false positives when deploy paths include folder names containing net.
Changes:
- Updates the target framework regex to avoid matching
net...after letters, digits, or dots. - Adds an inline comment explaining the folder-name false-positive case.
| // https://docs.microsoft.com/dotnet/standard/frameworks | ||
| const targetFrameworkRegExp: RegExp = /net(standard|coreapp)?[0-9.]+/i; | ||
| // Use negative lookbehind to avoid matching "net" when it's part of a folder name (e.g. "Planet.net8.0") | ||
| const targetFrameworkRegExp: RegExp = /(?<![a-zA-Z0-9.])net(standard|coreapp)?[0-9.]+(?![a-zA-Z0-9])/i; |
| // https://docs.microsoft.com/dotnet/standard/frameworks | ||
| const targetFrameworkRegExp: RegExp = /net(standard|coreapp)?[0-9.]+/i; | ||
| // Use negative lookbehind to avoid matching "net" when it's part of a folder name (e.g. "Planet.net8.0") | ||
| const targetFrameworkRegExp: RegExp = /(?<![a-zA-Z0-9.])net(standard|coreapp)?[0-9.]+(?![a-zA-Z0-9])/i; |
Member
|
@copilot apply changes based on the comments in this thread |
…fix false positives and first-match issues Agent-Logs-Url: https://github.com/microsoft/vscode-azurefunctions/sessions/645f301f-6011-4722-be45-447828623a34 Co-authored-by: nturinski <5290572+nturinski@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/vscode-azurefunctions/sessions/645f301f-6011-4722-be45-447828623a34 Co-authored-by: nturinski <5290572+nturinski@users.noreply.github.com>
Contributor
Author
Applied in d105304. Replaced the lookbehind/lookahead approach with a pattern anchored to the known .NET build output path structure: This fixes both issues raised in the review:
The replacement function reconstructs the matched segment ( |
Copilot
AI
changed the title
Fix targetFramework regex incorrectly matching folder names containing "net" in deploy path
Fix targetFramework detection incorrectly matching folder names containing "net" in deploy path
May 19, 2026
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.
The original TFM detection matched
netanywhere in the deploy subpath string, causing false positives when project folder names containednetfollowed by digits/dots (e.g.Planet.net8.0,my_net8.0). This triggered a spurious mismatch warning and caused "Update VS Code config" to corrupt the folder name portion ofazureFunctions.deploySubpathinstead of updating the actual TFM segment. A lookbehind/lookahead approach still left two gaps: characters like_or-beforenetsatisfied the lookbehind, and.match()returning the first occurrence meant a project folder named like a TFM (e.g.net8.0/bin/Release/net6.0/publish) would be corrupted before the real TFM segment was reached.Changes
src/vsCodeConfig/verifyTargetFramework.ts: Replaced the generictargetFrameworkRegExpwith abuildOutputPatternanchored to the known .NET build output path structurebin/(Debug|Release)/<TFM>:The TFM is extracted from capture group 3 (always within
bin/Debug/<TFM>orbin/Release/<TFM>), and the replacement function reconstructs only that segment while preserving the path separator and build type. For a path likenet8.0/bin/Release/net6.0/publish, the pattern correctly identifiesnet6.0as the TFM regardless of what precedesbin/.