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

[Feature] The global CLI tool should target net6.0 as well #2007

Closed DavidZidar closed 2 years ago

DavidZidar commented 2 years ago

Current the CLI only targets .NET Core 3.1 and .NET 5 so it requires either of them to be installed to be able to be used.

.NET 6 is the LTS version going forward so it should really be supported by the CLI as well.

mxschmitt commented 2 years ago

Do you run into any issues? For me its working:

➜  playwright-dotnet git docker run -it mcr.microsoft.com/dotnet/sdk:6.0 /bin/bash
root@f8e83227f5eb:/# dotnet tool install -g Microsoft.Playwright.CLI
export PATH="$PATH:/root/.dotnet/tools"
playwright --help

Keep in mind that we don't recommend the CLI anymore and have the ps1 script now (See in the docs).

DavidZidar commented 2 years ago

Oh I see, thank you for the heads up, guess I'll migrate then.

But in any case, it's running it that's the problem when no compatible .NET runtime version is installed (in this case I'm in Linux):

> dotnet playwright
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
  - The following frameworks were found:
      6.0.2 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=debian.11-x64
DavidZidar commented 2 years ago

@mxschmitt Maybe I'm bad at reading but has this PowerShell script been mentioned in any release notes? I'm looking all the way back to version 1.12 and I don't see it. Also the CLI is prominently featured in the docs and the PowerShell script is not really described at all, only used in a few examples. I'm sure I'm missing something but it seems to me some more work could be done to clear things up.

DavidZidar commented 2 years ago

You know what, I just found issue #1668 and version 1.2.2 of the CLI does in fact work in .NET 6 even though the NuGet package does not include a version for .NET 6, I think that threw me off. I was using version 1.2.0.

For reference, version 1.2.2 only includes netcoreapp3.1 and net5.0 https://nuget.info/packages/Microsoft.Playwright.CLI/1.2.2

Same as 1.2.0 https://nuget.info/packages/Microsoft.Playwright.CLI/1.2.0

And the csproj only has netcoreapp3.1 and net5.0 as well https://github.com/microsoft/playwright-dotnet/blob/82710bccaa67eb4a0bd1035ee332c676398e015d/src/Playwright.CLI/Playwright.CLI.csproj#L9

Go ahead and close this issue if you want, I'm still confused though.

campersau commented 2 years ago

@DavidZidar If you are curious the fix was https://github.com/microsoft/playwright-dotnet/pull/1792: https://github.com/microsoft/playwright-dotnet/blob/82710bccaa67eb4a0bd1035ee332c676398e015d/src/Playwright.CLI/Playwright.CLI.csproj#L22 Details in issue https://github.com/microsoft/playwright-dotnet/issues/1791

DavidZidar commented 2 years ago

@campersau Oh interesting, I was curious and didn't know about that property. Thank you for that info!

I'm closing the issue, next time I'll just try the latest version. :)

If you really recommend the ps1-script instead though I think the docs need to be updated to reflect this: https://playwright.dev/dotnet/docs/cli

mxschmitt commented 2 years ago

@campersau Oh interesting, I was curious and didn't know about that property. Thank you for that info!

I'm closing the issue, next time I'll just try the latest version. :)

If you really recommend the ps1-script instead though I think the docs need to be updated to reflect this: https://playwright.dev/dotnet/docs/cli

See https://github.com/microsoft/playwright/pull/12025 which goes live in 1.19

DavidZidar commented 2 years ago

@mxschmitt Excellent!