microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[BUG] MSB3073 error with Microsoft.Playwright 1.41.0 on Ubuntu #2827

Closed martincostello closed 9 months ago

martincostello commented 9 months ago

System info

Source code

Link to the GitHub repository with the repro

https://github.com/martincostello/dotnet-patch-automation-sample/commit/a41590758cadf4bc65b270cf05822d80bfadb0a5 in https://github.com/martincostello/dotnet-patch-automation-sample/pull/419

Steps

Expected

Code compiles and tests pass.

Actual

Build fails with error MSB3073:

/home/runner/.nuget/packages/microsoft.playwright/1.41.0/buildTransitive/Microsoft.Playwright.targets(65,5): error MSB3073: The command "chmod +x """ exited with code 1. [/home/runner/work/dotnet-patch-automation-sample/dotnet-patch-automation-sample/tests/TodoApp.Tests/TodoApp.Tests.csproj]

It appears that something is going wrong here:

https://github.com/microsoft/playwright-dotnet/blob/e964457aa770c39ecb8f3605da512791b6f527a9/src/Playwright/build/Microsoft.Playwright.targets#L65

johnboygit commented 9 months ago

I've also just run into this issue on my build pipeline

mxschmitt commented 9 months ago

The issue seems that we are using OutputPath which concatenates the paths incorrectly (no trailing slash). In the example from @martincostello:

https://github.com/microsoft/playwright-dotnet/blob/e015d04439845ce7ad12d8bdad7c15a36a74465a/src/Playwright/build/Microsoft.Playwright.targets#L62C41-L62C51

OutDir = /workspaces/dotnet-patch-automation-sample/artifacts/
OutputPath = /workspaces/dotnet-patch-automation-sample/artifacts

I think we should just use OutDir and it should work. cc @campersau

As a workaround add a trailing slash at the end of --output.

martincostello commented 9 months ago

You could also use EnsureTrailingSlash.

campersau commented 9 months ago
OutDir OutputPath PublishDir
dotnet build :white_check_mark: bin/Debug/net8.0/ :white_check_mark: bin/Debug/net8.0/ :white_check_mark: bin/Debug/net8.0/publish/
dotnet build --output bin/Custom :white_check_mark: bin/Custom/ :x: bin/Custom :interrobang: bin/Custompublish/
dotnet publish :white_check_mark: bin/Release/net8.0/ :white_check_mark: bin/Release/net8.0/ :white_check_mark: bin/Release/net8.0/publish/
dotnet publish --output bin/Custom :white_check_mark: bin/Release/net8.0/ :white_check_mark: bin/Release/net8.0/ :x: bin/Custom

So we could use OutDir instead of OutputPath but PublishDir would always require $([MSBuild]::EnsureTrailingSlash('$(PublishDir)')).

mxschmitt commented 9 months ago

I tried using OutDir and it broke some of the tests. Wasn't reproducible locally tho, maybe some stray files: https://github.com/microsoft/playwright-dotnet/actions/runs/7557081073/job/20575513392

martincostello commented 9 months ago

If it helps, most of my repos use the new .NET 8 artifacts output which may have contributed to the issue, though this issue has only affected some of them.