-
Notifications
You must be signed in to change notification settings - Fork 621
Description
Problem
The MAUI sample build fails on Windows CI in the Samples stage with CS0016 errors:
CSC(0,0): Error CS0016: Could not write to output file
'D:\a\1\s\output\samples\Basic\Maui\SkiaSharpSample\obj\Release\net10.0-windows10.0.19041.0\win-x64\generated\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.XamlGenerator\GlobalXmlns.g.cs'
-- 'Could not find a part of the path ...'
This affects multiple source generators: XAML generator, binding source generator, and WinRT AOT source generator.
Root Cause
The MAUI source generators create deeply nested output paths under obj/. When the CI workspace is already deep (D:\a\1\s\output\samples\Basic\Maui\...), the generated file paths exceed the Windows MAX_PATH limit (260 characters).
The samples-generate cake task copies samples to output/samples/, adding an extra directory layer that pushes the paths over the limit.
Impact
5/10 recent main builds have Samples stage failures on Windows due to this. The macOS and Linux Samples jobs pass (no path length limit).
Recommendations
-
Shorten the output path — Use a shorter output directory in the pipeline, e.g.
D:\sinstead ofD:\a\1\s. -
Enable long paths — Set
LongPathsEnabledin the Windows registry on CI agents, or use the MSBuild property:<PropertyGroup> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> </PropertyGroup>
-
Shorten project name — Rename
SkiaSharpSampleto something shorter in the generated output, or flatten the output directory structure. -
Use .NET 10 long path support — Ensure the CI agent has the
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabledregistry key set to 1.
Data
5/10 recent main builds (156326, 156346, 156367, 156384, 156423) show this failure.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status