selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🚀 Feature]: Add .NET 6.0 to dotnet project build targets

Open cgv-wd opened this issue 3 years ago • 3 comments

Feature and motivation

.NET 6.0 SDK was recently publicly released, so we should consider adding .NET 6 to the list of target frameworks for each dotnet project.

Not much has changed from NET 5 to NET 6 in terms of required source changes, however .NET 6 lists Visual Studio 2022 as a requirement so keep that in mind.

Usage example

I was able to successfully update the following projects and build .NET 6 DLLs from Visual Studio 2022:

  • WebDriver
  • WebDriver.Support
  • WebDriverBackedSelenium

Rough steps on updating project to support .NET 6 (Note VS2022 is required for full .NET 6 support):

  1. Install latest .NET 6.0 SDK and latest Visual Studio 2022
  2. Edit each project and nuspec file to specify net6.0 where applicable.
  3. Edit preprocessor directives in relevant sources to include NET6_0_OR_GREATER (or NET6_0) where applicable or you will encounter an error when building sources that use system drawing methods (like screenshotting)

You may be able to get around installing VS2022, if one were to just perform the above changes and then build with the NET 6 SDK installed, however I have not tried this myself so cannot speak to how this workaround might work.

cgv-wd avatar Mar 22 '22 15:03 cgv-wd

@cgv-wd, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Mar 22 '22 15:03 github-actions[bot]

Given that the .NET bindings are not moving away from Bazel as the build tool, Bazel will need to support VS 2022 before this can be done properly. As of January 2022, Bazel did not offer that support; I have not been able to get back to inquire as to whether that support has yet been added. Once it is, it will be reasonably easy to add that as a build target to the existing build.

jimevans avatar Mar 22 '22 22:03 jimevans

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

github-actions[bot] avatar Aug 12 '22 07:08 github-actions[bot]

Created issue at Bazel to get this started: https://github.com/bazelbuild/bazel/issues/16378

jerone avatar Oct 03 '22 08:10 jerone

@jimevans Bazel responded with "Bazel should work with VS2022 [..]". Would it be possible to see if dotnet 6.0 support could be implemented.

jerone avatar Oct 18 '22 20:10 jerone

@jerone if I get you a .nupkg with 6.0 target added, would you be able to verify for us that it works?

titusfortner avatar Oct 19 '22 20:10 titusfortner

@titusfortner We are still in the investigation status for moving to dotnet 6.0. I'll try to get the upgrade more priority on the roadmap, but it might take some time. Hopefully someone else is in the position to test.

jerone avatar Oct 20 '22 13:10 jerone

@jimevans added this with #11298 I think something still needs to be updated in csproj files?

titusfortner avatar Nov 23 '22 19:11 titusfortner

@cgv-wd any issues running on .net6 target framework? I am on .net7, works good.

nvborisenko avatar Nov 25 '22 20:11 nvborisenko

FYI, according to last comment: https://github.com/bazelbuild/bazel/issues/16378#issuecomment-1329234659

Yes, the latest Bazel 5.3.2 should already support VS2022, we'll update the documentation soon, thanks for the report!

jerone avatar Nov 28 '22 16:11 jerone

As I understand it, you already should be able to use .net6 & .net7 because Selenium supports netstandard2.1.

That said, I'm finishing up what Jim started and we should have an explicit .net6 target working for the next release.

titusfortner avatar Nov 28 '22 17:11 titusfortner

I think I got everything else covered with this - d2838e1291032fde9e0da47ad6bb809f03c53deb

I built the solution and tested it in Mac, Win10 & Win11 without issues.

titusfortner avatar Nov 29 '22 17:11 titusfortner

Thanks @titusfortner for moving this forward. 👍

jerone avatar Nov 29 '22 19:11 jerone

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 30 '22 00:12 github-actions[bot]