Minimal reproduction: https://github.com/mwiemer-microsoft/xliff-tasks-issue-842/tree/c08a6970493aa4d3a48aafd768b19f91ce81a259
- Build any repo using
.resx and ResXFileRef (including dotnet/roslyn)
- Rename your clone of the repo
- Build again
Expected: just works
Actual: Fails:
error MSB3103: Invalid Resx file. Could not find a part of the path
'C:\old-location-that-no-longer-exists\icon.bin'. [Repro.csproj]
Suspected root cause
When XliffTasks translates a .resx file that contains ResXFileRef entries with relative paths (e.g. Dictionary.dic), the generated translated .resx placed in the intermediate output directory (e.g. artifacts/obj/.../MyProject.xlf/MyProject.resx) receives absolute paths instead:
<!-- Source (MyProject.resx) — relative path -->
<data name="Dictionary" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Dictionary.dic;System.String</value>
</data>
<!-- Generated (artifacts/obj/.../MyProject.xlf/MyProject.resx) — absolute path -->
<data name="Dictionary" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>C:\Users\me\repos\myproject\src\MyProject\Dictionary.dic;System.String</value>
</data>
Suggested fix
Store the ResXFileRef path as a path relative to the translated .resx output file (i.e. the relative path from $(XlfIntermediateOutputPath)/.../<lang>/<ProjectName>.resx back to the original resource file)
Environment
XliffTasks version: 10.0.0-beta.26304.4 (also reproduced on older versions)
MSBuild / dotnet: desktop MSBuild 17.x (Build.cmd) and dotnet build (SDK 10.x)
OS: Windows
Minimal reproduction: https://github.com/mwiemer-microsoft/xliff-tasks-issue-842/tree/c08a6970493aa4d3a48aafd768b19f91ce81a259
.resxandResXFileRef(including dotnet/roslyn)Expected: just works
Actual: Fails:
Suspected root cause
When XliffTasks translates a
.resxfile that containsResXFileRefentries with relative paths (e.g.Dictionary.dic), the generated translated.resxplaced in the intermediate output directory (e.g.artifacts/obj/.../MyProject.xlf/MyProject.resx) receives absolute paths instead:Suggested fix
Store the ResXFileRef path as a path relative to the translated .resx output file (i.e. the relative path from
$(XlfIntermediateOutputPath)/.../<lang>/<ProjectName>.resxback to the original resource file)Environment
XliffTasks version: 10.0.0-beta.26304.4 (also reproduced on older versions)
MSBuild / dotnet: desktop MSBuild 17.x (Build.cmd) and dotnet build (SDK 10.x)
OS: Windows