-
Notifications
You must be signed in to change notification settings - Fork 839
Description
Current behavior
On Linux, builds can fail with:
MSB3024: Could not copy the file ".../obj/.../apphost" to the destination file ".../bin/.../<AssemblyName>", because the destination is a folder instead of a file.
In our case, a folder named <AssemblyName> is created in output, then apphost tries to copy to the same path (no extension on Linux), causing a folder/file collision.
Why this happens
Two target behaviors combine:
-
Microsoft.Playwright.targetsadds content (playwright.ps1, and optionally.playwright/*) to output.~/.nuget/packages/microsoft.playwright/1.58.0/buildTransitive/Microsoft.Playwright.targetsContent Include="$(MSBuildThisFileDirectory)playwright.ps1"(lines ~52-55)
-
Uno rewrites
ContentFilesProjectOutputGroupOutputto prefix$(UnoPriInitialPath)(which defaults to$(AssemblyName)).~/.nuget/packages/uno.winui/6.5.153/buildTransitive/uno.ui.tasks.assets.targets_UnoAddAssetsFilesToCopyLocallines ~189-207- specifically:
Link ... $(UnoPriInitialPath)/%(ContentFilesProjectOutputGroupOutput.Link)TargetPath ... $(UnoPriInitialPath)/%(ContentFilesProjectOutputGroupOutput.TargetPath)
This produces e.g. TargetPath=<AssemblyName>/playwright.ps1, which creates the <AssemblyName> directory and then collides with apphost destination <AssemblyName>.
Evidence from diagnostic build
From dotnet build -v:diag:
TargetPath=MonacoEditorComponentTests/playwright.ps1- then apphost copy tries destination
.../bin/.../MonacoEditorComponentTests - then
MSB3024folder-vs-file error
Repro (from real project)
Project: MonacoEditorComponent.Tests (net10.0, OutputType=Exe, AssemblyName=MonacoEditorComponentTests) references Uno.WinUI transitively and Microsoft.Playwright.
dotnet build MonacoEditorComponent.Tests/MonacoEditorComponent.Tests.csproj
Fails on Linux with MSB3024 as above.
Notes
- This appears Linux/macOS-specific in practice because apphost has no
.exeextension. - Even with
-p:PlaywrightPlatform=none,playwright.ps1is still added by Playwright and still gets Uno-prefixed, so collision remains.
Expected behavior
Uno asset copy-local prefixing should not create output paths that can collide with apphost destination (or at minimum should avoid prefixing non-Uno package content such as Playwright content files).