[🚀 Feature]: Add .NET 6.0 to dotnet project build targets
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):
- Install latest .NET 6.0 SDK and latest Visual Studio 2022
- Edit each project and nuspec file to specify
net6.0where applicable. - Edit preprocessor directives in relevant sources to include
NET6_0_OR_GREATER(orNET6_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, 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!
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.
This issue is looking for contributors.
Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.
Created issue at Bazel to get this started: https://github.com/bazelbuild/bazel/issues/16378
@jimevans Bazel responded with "Bazel should work with VS2022 [..]". Would it be possible to see if dotnet 6.0 support could be implemented.
@jerone if I get you a .nupkg with 6.0 target added, would you be able to verify for us that it works?
@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.
@jimevans added this with #11298 I think something still needs to be updated in csproj files?
@cgv-wd any issues running on .net6 target framework? I am on .net7, works good.
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!
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.
I think I got everything else covered with this - d2838e1291032fde9e0da47ad6bb809f03c53deb
I built the solution and tested it in Mac, Win10 & Win11 without issues.
Thanks @titusfortner for moving this forward. 👍
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.