Closed pkanavos closed 2 years ago
Thanks for brining this up!
Since .NET 6 is still a preview, it's not a scenario we looked at yet. It sounds like it might require a completely different approach to packaging the drivers, though. That said, PR #1520 might provide a reasonably sufficient workaround. I've added an additional guard to the location check though.
I have the same issue when using the PublishSingleFile
option when publishing a .NET 5 project. In v1.9.2 this was working without any issues.
dotnet publish "src/MyProject.csproj" -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false -o /publish
Both v1.12.2 and v1.13.0-next-1 throws System.ArgumentException: The path is empty
.
@eddietisma I suspect the problem is that we reset the location of the assembly, if we can't find Microsoft.Playwright.dll
in the same place - which we need to provide CLI
functionality. #1603 will likely fix it, assuming we go ahead and merge it.
As a workaround, though, you can place a file and call it Microsoft.Playwright.dll
next to the published single file, and it should work.
Closing as part of the triage process since it seemed stale or did not get enough upvotes in the past. Please create a new issue with a detailed reproducible or feature request if you still face issues.
In .NET 6 single-file applications, Assembly.Location is documented to return an empty string. This causes the
Microsoft.Playwright.Helpers.Paths.GetExecutablePath()
method called byPlaywright.CreateAsyn()
to fail with the following exception:The method is trying to identify Playwright's path by checking the library's location. In this case though,
Assembly.Location
will be empty:In this case, the
playwright.ps1
script will also fail because it tries to load the Playwright assembly explicitly:https://github.com/microsoft/playwright-dotnet/blob/1b18e16cd3ac16188d8e52a8c1f427e98c18aff3/src/Playwright/Helpers/Paths.cs#L37