Fix ResXFileRef/Bitmap href paths in translated .resx/.vsct: relative instead of absolute#17071
Draft
mwiemer-microsoft with Copilot wants to merge 3 commits into
Draft
Fix ResXFileRef/Bitmap href paths in translated .resx/.vsct: relative instead of absolute#17071mwiemer-microsoft with Copilot wants to merge 3 commits into
mwiemer-microsoft with Copilot wants to merge 3 commits into
Conversation
… of absolute When TranslateSource writes the translated .resx (and .vsct) to the intermediate output directory, ResXFileRef/Bitmap href entries previously had their paths rewritten to absolute paths. This broke incremental builds after the repo was renamed or moved, because the baked-in absolute path no longer existed. Fix: compute the path relative to the translated output file's directory instead of an absolute path. Uses Uri.MakeRelativeUri for cross-platform compatibility. Falls back to absolute path if source/output are on different drives (Windows). - Add RewriteRelativePathsForOutputPath(sourceFullPath, outputFullPath) to TranslatableDocument base class with MakeRelativePath helper - Override in ResxDocument (ResXFileRef data entries) and VsctDocument (Bitmap href attributes) to use relative paths - Update TranslateSource to call the new method with both source and translated output paths - Update tests to verify relative-path behavior
Copilot
AI
changed the title
[WIP] Fix ResXFileRef absolute path issue in translated .resx files
Fix ResXFileRef/Bitmap href paths in translated .resx/.vsct: relative instead of absolute
Jul 2, 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.
TranslateSourcewas baking absolute paths into translated.resxand.vsctfiles written to the intermediate output directory. Any repo rename/move caused subsequent builds to fail withMSB3103: Could not find a part of the path 'C:\old-location\...'because the stale absolute paths no longer resolved.Root cause
RewriteRelativePathsToAbsoluteinResxDocumentandVsctDocumentresolvedResXFileRef/Bitmap hrefpaths against the source.resx/.vsctdirectory and stored them as absolute paths — making the cached output location-dependent.Changes
TranslatableDocument— replaces the old single-argRewriteRelativePathsToAbsolute(sourceFullPath)with:RewriteRelativePathsForOutputPath(sourceFullPath, outputFullPath)— new virtual method subclasses overrideMakeRelativePath(fromDirectory, toPath)— protected static helper usingUri.MakeRelativeUri; falls back to absolute when source/output are on different drivesResxDocument— overridesRewriteRelativePathsForOutputPath; rewritesResXFileRefvalue paths relative to the output.resxdirectoryVsctDocument— same fix for<Bitmap href="...">attributesTranslateSource— callsRewriteRelativePathsForOutputPath(sourcePath, translatedFullPath)instead of the old single-arg formTests — updated
ResxDocumentTestsandVsctDocumentTeststo assert the output contains a relative path and does not contain the absolute base path; covers the typical case where source and output directories differBefore / after (intermediate
MyProject.resx):To double check: