Skip to content

_UnoAddAssetsFilesToCopyLocal can create AssemblyName folder that collides with Linux apphost output (Playwright content case) #22692

@clairernovotny

Description

@clairernovotny

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:

  1. Microsoft.Playwright.targets adds content (playwright.ps1, and optionally .playwright/*) to output.

    • ~/.nuget/packages/microsoft.playwright/1.58.0/buildTransitive/Microsoft.Playwright.targets
    • Content Include="$(MSBuildThisFileDirectory)playwright.ps1" (lines ~52-55)
  2. Uno rewrites ContentFilesProjectOutputGroupOutput to prefix $(UnoPriInitialPath) (which defaults to $(AssemblyName)).

    • ~/.nuget/packages/uno.winui/6.5.153/buildTransitive/uno.ui.tasks.assets.targets
    • _UnoAddAssetsFilesToCopyLocal lines ~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 MSB3024 folder-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 .exe extension.
  • Even with -p:PlaywrightPlatform=none, playwright.ps1 is 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).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions