31/07/2021

Licensing Consultant

Not just any technology

Get your Visual Studio extensions ready for 64-bit

Visual Studio has been at the heart of Microsoft’s developer platform for more than 20...

Visual Studio has been at the heart of Microsoft’s developer platform for more than 20 years. To begin with only a application bundle with a typical glimpse and experience, it is evolved above the years into a single improvement atmosphere that supports most improvement jobs. The future variation, Visual Studio 2022, is potentially the greatest release for some time, with a general public preview now accessible.

There are a few variations of Visual Studio: a free of charge community version for private, academic, and open up-source initiatives a qualified version for small teams and an business version for substantial improvement teams and substantial initiatives, with cross-platform help. The two increased editions are accessible as subscriptions, with qualified pricing at $45 per person per month and business at $250 per person per month.

Preview variations of all a few editions are accessible utilizing your present license to enable the suitable just one. If you’re utilizing Neighborhood, you’re accredited for a Visual Studio 2022 Neighborhood preview, and so on for Expert and Business.

You never have to reserve a full Personal computer to check out out the preview. An important transform a several years back was the improvement of a new installer that allows you to operate various releases of Visual Studio aspect by aspect. This way you can hold a manufacturing build to work with present-day language variations whilst still screening out preview releases. The process functions nicely: I am jogging a set of the Visual Studio 2017 build instruments for Visual Studio Code, the present-day Visual Studio 2019 release, and preview builds of both equally Visual Studio 2019 and 2022. All four installations are managed with the same installation application, enabling me to select and select different workloads for different releases.

A sixty four-bit Visual Studio at previous

One of the greatest variations to Visual Studio 2022 is the change to a sixty four-bit platform. It’s not a visible transform but impacts anything in the platform, from how it functions with substantial knowledge sources to how extensions work with the new architecture. As improvement components results in being more able (my key improvement technique is a Xeon-E NUC workstation with 32GB of RAM which is still received a great deal of growth area), utilizing all the accessible technique assets makes a good deal of perception, lessening compile instances and supporting bigger knowledge sets for equipment mastering. A sixty four-bit Visual Studio should really increase developer productivity, as you won’t have to wait so long for functions to comprehensive.

There have been two preview releases so considerably. The initial didn’t include numerous new capabilities beyond sixty four-bit help (and in actuality missed some Visual Studio 2019 capabilities). Finding a preliminary build out the doorway rapidly allowed Microsoft and partners to start off the process of migrating extensions to the new architecture, with only current extensions in the Visual Studio market. Visual Studio 2022 includes extension improvement instruments, with help for the new SDKs in Visual Studio 2019. If you’re transport a Visual Studio extension it is important to down load the preview and update your extensions in progress of an predicted Tumble 2021 release.

Updating VSIX extensions for Visual Studio 2022

Microsoft has revealed the procedure for updating present extensions. Very first down load the new variation of the Visual Studio SDK from NuGet. This arrives in two packages: a meta-bundle with most of the required assemblies wanted to build an current Visual Studio extension and a set of build instruments wanted to generate the suitable VSIX files for your extension. There’s a need to compile for “Any CPU” or for “x64,” as 32-bit extensions will not load in Visual Studio 2022. Nevertheless, which is not the only way to assure compatibility with more mature releases and work with the new extension APIs.

Start off by modernizing the underlying task by transforming and updating bundle references. You should now use PackageReference Involve statements fairly than Reference Involve, with numerous more mature references now replaced by the meta-bundle. Wherever you could have taken a dependency on Visual Studio’s build instruments to instantly load assemblies in its research route, you’re now heading to need to use a PackageReference to explicitly load the assembly in query. Mainly because this moves your dependencies to NuGet fairly than local files, you could need to do more work to assure builds comprehensive without the need of warnings.

Use shared initiatives for compatibility with more mature variations

The variations in Visual Studio 2022 do mean that extensions built for the new IDE won’t work on more mature variations, so if you want to hold compatibility with Visual Studio 2019 or before, you need to build your VSIX extension as a shared task. This way you can hold much of the same code by guaranteeing that every concentrate on has references to the suitable variation of the Visual Studio SDKs. When you build your code, you get two different VSIX files: a sixty four-bit variation for Visual Studio 2022 and a 32-bit variation for more mature releases.

Once you’ve created a shared task primarily based on an present VSIX, include a new Visual Studio 2022 targeted task that contains references to the new SDK. You never need Visual Studio 2022 to do this it is all feasible in Visual Studio 2019. All you then need to do is set the suitable compilation concentrate on to sixty four-bit (possibly amd64 for C++ code or x64 for C#). Once your code has compiled, use a preview duplicate of Visual Studio 2022 to exam it out.

Observe out for breaking variations to APIs

It’s important to don’t forget that any modules your code uses will have to be compiled for sixty four-bit. If they’re your very own code, then all you should really need to do is set the suitable concentrate on if not, work with your sellers to get current variations. Other troubles could need to be tackled about changes to the API that can crack your code. One of the more typical troubles is most likely to be code that utilised 32-bit integers to hold pointers. All you need to do is transform the sort to an IntPtr, which will set the suitable size for the variable and stop conversion faults.

Some APIs have been removed as nicely. This can be more of an issue, whilst there are advisable updates for most of the APIs. For case in point, if your extension uses device recommendations through IToolTipProvider, you should really swap to the new IToolTipService API. At a increased-level Microsoft is completely replacing Visual Studio’s XAML Designer with a new extensibility design for controls primarily based on that utilised in .Web 5 and .Web Main. This will call for major rework, but it should really final result in a layout extension which is prepared for .Web 5 and .Web six and new cross-platform technologies like MAUI.

Finding your extension code prepared for Visual Studio 2022 shouldn’t be challenging if you abide by Microsoft’s directions. With aspect-by-aspect installs, the process should really be even less difficult as you can make the vital variations in Visual Studio 2019, build your VSIX, and then exam in Visual Studio 2022 without the need of transforming improvement PCs.

Copyright © 2021 IDG Communications, Inc.