DOTNET 6 and Visual Studio 2022

Currently I am only working with LTS version of .NET, it’s rare that there is any benefit for me from updating to non LTS versions. As .NET 6 has just been released I’ve downloaded it and at the same time downloaded the brand new Visual Studio 2022.

Visual Studio installation

You can’t help but notice the new icons. MS have made quite a big thing about this but it’s something they do on each release. I guess they are a bit cleaner than the old ones and I will eventually get used to them. Overall I quite like the new look, for the dark theme at least. There are/will be more themes available but previewing them isn’t a great experience as all you seem to get is a tiny image that frankly doesn’t tell you much.

Another nice feature was that all my settings seem to have been retained. I can’t recall off hand if this has happened previously but it is certainly a nice to have. Personally I still take a look through a lot of the settings to see if there is anything I want to change.

I opened a solution with a view to upgrading it to .NET 6. This went well and all seemed to work as normal. One thing I did notice was that the project properties page has changed to one that scrolls rather than separate pages. Personally I’m not very keen on this but in .NET core I use it less anyway than I would in .NET framework.

Updating Paket files

// limit frameworks to LTS versionsframework:  dotnet6, netcoreapp3.1

NOTE that you can’t use dotnet6 in the TFM, instead you use net6.0 Unfortunately this didn’t resolve the whole problem, as I use global.json to specify which SDK to use I needed to update that too but that’s where I started to come unstuck. Eventually I gave up for now, I’ll return to it in a week or two when hopefully the issue will be resolved. The issue seems to be related to the TFM

So for now I have global.json set to use .net 6.0.100 and everything else is unchanged and that seems to be working, which is a start.

First impressions

Second impressions

There is a new version of Paket which will likely resolve the issues I was having. The paket developers are notoriously quick at resolving these sorts of issues. The version I am using now is 6.2.1.

After going up a few blind alleys I now have a process for adding .net 6.0 to my existing libraries. Put simply this is a copy and paste exercise.

In my case I create a new branch in my repo and do it there. The first thing is to remove all the things that aren’t code e.g. the .paket folder and the sln and proj files along with anything else that can easily be regenerated or might specify or depend on a specific version of .Net.

The next step is to recreate the sln and proj files using the dotnet new command. I then open the new solution in VS 2022 and add any project references etc. The next step is to put the TFM’s in place as normal and to turn off ImplicitUsings. I then ensure the appropriate nuget packages are installed. The library should now look pretty much like normal. At this point I install paket as usual and run

paket convert-from-nuget

I then update the paket dependencies to what I need it to be and I’m pretty much ready to go. So far this has worked consistently for me.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Steve Ellwood

Senior Integrations Officer at Doncaster Council Any views expressed are entirely my own.