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

Could not load file or assembly 'Microsoft.Bcl.AsyncInterface #1531

Closed tjipz8 closed 3 years ago

tjipz8 commented 3 years ago

error when executing playwright install:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. File name: 'Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at System.Reflection.RuntimeAssembly.GetExportedTypes() at Microsoft.Playwright.CLI.Program.Main(String[] args) in /_/src/Playwright.CLI/Program.cs:line 53

I have tried added Microsoft.Bcl.AsyncInterface into my Microsoft.Bcl.AsyncInterfaces to my csproject but the error still there

examosa commented 3 years ago

@tjipz8 I encountered this issue as well. Did you find a resolution?

DanielBailey1001001 commented 3 years ago

I also have this issue. The old Playwright was deprecated so I changed it over to this Microsoft one and it does not install. I have tried copying that dll to various places and it keeps arguing with me that it can't find it. I have the nuget for it on the project. I wonder if it is because I have not upgraded to .NET 5 yet, still on 4.61 but I would have thought it would know about that.

examosa commented 3 years ago

@DanielBailey1001001 I figured it out. In my case, I still have the .NET Core 3.1 SDK installed, which is what I think was being targeted upon install. Microsoft.Bcl.AsyncInterfaces is only available by default in the .NET 5 SDK. I was able to get the cli working with the following command:

dotnet tool install -g Microsoft.Playwright.CLI --framework net5.0

Your project doesn't necessarily have to be .NET 5, but you need to have the SDK installed.

EDIT: I take it back; that didn't work either. Still looking for a solution...

DanielBailey1001001 commented 3 years ago

I agree it must be something to do with not having the right bits in for framework 5, but I don't want to upgrade my massive solution yet. Reading between the lines I think this issue is having the same problem: https://github.com/microsoft/playwright-dotnet/issues/1546#issue-923001036

DanielBailey1001001 commented 3 years ago

I have got the install to work and my tests are working again finally, first find the nuget package folder, assuming you have added the nuget to your project first: \MySolutionFolder\packages\Microsoft.Playwright.1.13.0-next-1.playwright Copy the folder above manually to your bin/debug folder: \MySolutionFolder\MyTestProject\bin\Debug.playwright Now you can run the install to get the browsers: \MySolutionFolder\MyTestProject\bin\Debug.playwright\node\win32_x64\playwright.cmd install From there everything should work like it used to in the old Playwright nuget.

djpruitt commented 3 years ago

Has this issue been fixed? I am getting the same error.

DanielBailey1001001 commented 3 years ago

On Microsoft.Playwright.1.14.0 I still had the same error, I think because I am using framework4.6.1 and it might have only been fixed for .Net Core and later. Using this instead of the CLI worked for me: $(Build.SourcesDirectory)\packages\Microsoft.Playwright.1.13.0-next-1\.playwright\node\win32_x64\playwright.cmd install

luckybrowne commented 3 years ago

Working through the tutorial for .NET Core. I'm attempting to use the latest version (at time of writing) Microsoft.Playwright 1.14.1 .NET Core 3.1 SDK installed. I got the same errors reported here. Given I'm not actually applying this to a real project yet and evaluating I upgraded to .NET core 5.0 (SDK version 5.0.400) and started the tutorial steps all over again and still got the issue

mrwensveen commented 3 years ago

Why is this issue closed? @tjipz8 closed this on the same day it was opened, but obviously the issue is not resolved for some people, including me.

mrwensveen commented 3 years ago

Opened a new issue for this: #1747