question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jimevanscommented, Mar 22, 2022

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.

1reaction
titusfortnercommented, Nov 29, 2022

I think I got everything else covered with this - d2838e1291032fde9e0da47ad6bb809f03c53deb

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to target .NET 6.0 with Visual Studio 2019? - Microsoft Q&A
Under Options, Environment, Preview Features set Use previews of the .NET SDK to true, restart Visual Studio. Restart, in a Visual Studio ...
Read more >
Target frameworks in SDK-style projects - .NET | Microsoft Learn
When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to...
Read more >
Port from .NET Framework to .NET 6 - .NET Core
Understand the porting process and discover tools you may find helpful when porting a .NET Framework project to .NET 6.
Read more >
dotnet build command - .NET CLI | Microsoft Learn
The dotnet build command builds the project and its dependencies into a set of binaries. The binaries include the project's code in ...
Read more >
Targeted .NET Frameworks - Visual Studio (Windows)
Learn how to specify the version of the .NET Framework that you want your project to target so the application can only use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found