Complete News World in United States

Get your Visual Studio extensions ready for 64-bit

Visible Studio has been on the coronary heart of Microsoft’s developer platform for greater than 20 years. Initially solely a software program bundle with a standard appear and feel, it’s developed through the years right into a single improvement surroundings that helps most improvement duties. The next version, Visual Studio 2022, is probably the largest launch for a while, with a public preview now accessible.

There are three versions of Visual Studio: a free neighborhood version for private, instructional, and open-source tasks; knowledgeable version for small groups; and an enterprise version for big improvement groups and enormous tasks, with cross-platform assist. The 2 increased editions can be found as subscriptions, with skilled pricing at $45 per consumer per thirty days and enterprise at $250 per consumer per thirty days.

Preview versions of all three editions are available utilizing your present license to allow the suitable one. For those who’re utilizing Group, you’re licensed for a Visible Studio 2022 Group preview, and so forth for Skilled and Enterprise.

You don’t have to order a complete PC to check out the preview. An essential change a couple of years again was the event of a brand new installer that lets you run a number of releases of Visible Studio aspect by aspect. This manner you may hold a manufacturing construct to work with present language variations whereas nonetheless testing out preview releases. The method works effectively: I’m operating a set of the Visible Studio 2017 construct instruments for Visible Studio Code, the present Visible Studio 2019 launch, and preview builds of each Visible Studio 2019 and 2022. All 4 installations are managed with the identical set up app, permitting me to choose and select totally different workloads for various releases.

A 64-bit Visible Studio ultimately

One of many largest adjustments to Visual Studio 2022 is the shift to a 64-bit platform. It’s not a visual change however impacts every part within the platform, from the way it works with giant information sources to how extensions work with the brand new structure. As improvement hardware turns into extra succesful (my important improvement system is a Xeon-E NUC workstation with 32GB of RAM that’s nonetheless obtained loads of growth area), utilizing all of the accessible system sources makes a number of sense, lowering compile occasions and supporting bigger information units for machine studying. A 64-bit Visible Studio ought to enhance developer productiveness, as you received’t have to attend so lengthy for operations to finish.

There have been two preview releases thus far. The primary didn’t add many new options past 64-bit assist (and actually missed some Visible Studio 2019 options). Getting a preliminary construct out the door rapidly allowed Microsoft and companions to start the process of migrating extensions to the brand new structure, with solely up to date extensions within the Visible Studio market. Visible Studio 2022 consists of extension improvement instruments, with assist for the brand new SDKs in Visible Studio 2019. For those who’re transport a Visible Studio extension it’s essential to obtain the preview and replace your extensions upfront of an anticipated Fall 2021 launch.

Updating VSIX extensions for Visible Studio 2022

Microsoft has printed the process for updating present extensions. First obtain the brand new model of the Visible Studio SDK from NuGet. This is available in two packages: a meta-package with a lot of the required assemblies wanted to construct an up to date Visible Studio extension and a set of construct instruments wanted to create the suitable VSIX information to your extension. There’s a requirement to compile for “Any CPU” or for “x64,” as 32-bit extensions won’t load in Visible Studio 2022. Nonetheless, that’s not the one manner to make sure compatibility with older releases and work with the brand new extension APIs.

Begin by modernizing the underlying undertaking by altering and updating package deal references. You will need to now use PackageReference Embrace statements reasonably than Reference Embrace, with many older references now changed by the meta-package. The place you could have taken a dependency on Visible Studio’s construct instruments to mechanically load assemblies in its search path, you’re now going to wish to make use of a PackageReference to explicitly load the meeting in query. As a result of this strikes your dependencies to NuGet reasonably than native information, it’s possible you’ll must do extra work to make sure builds full with out warnings.

Use shared tasks for compatibility with older variations

The adjustments in Visible Studio 2022 do imply that extensions constructed for the brand new IDE received’t work on older variations, so if you wish to hold compatibility with Visible Studio 2019 or earlier, you’ll want to construct your VSIX extension as a shared project. This manner you may hold a lot of the identical code by guaranteeing that every goal has references to the suitable model of the Visible Studio SDKs. While you construct your code, you get two separate VSIX information: a 64-bit model for Visible Studio 2022 and a 32-bit model for older releases.

When you’ve created a shared undertaking based mostly on an present VSIX, add a brand new Visible Studio 2022 focused undertaking that incorporates references to the brand new SDK. You don’t want Visible Studio 2022 to do that; it’s all doable in Visible Studio 2019. All you then must do is ready the suitable compilation goal to 64-bit (both amd64 for C++ code or x64 for C#). As soon as your code has compiled, use a preview copy of Visible Studio 2022 to check it out.

Be careful for breaking adjustments to APIs

It’s essential to do not forget that any modules your code makes use of must be compiled for 64-bit. In the event that they’re your individual code, then all you need to must do is ready the suitable goal; in any other case, work along with your distributors to get up to date variations. Different points could have to be addressed about changes to the API that can break your code. One of many extra frequent points is more likely to be code that used 32-bit integers to carry pointers. All you’ll want to do is change the kind to an IntPtr, which is able to set the suitable dimension for the variable and stop conversion errors.

Some APIs have been removed as effectively. This may be extra of a problem, though there are really helpful updates for a lot of the APIs. For instance, in case your extension makes use of software ideas by way of IToolTipProvider, you need to change to the brand new IToolTipService API. At a higher-level Microsoft is totally changing Visible Studio’s XAML Designer with a brand new extensibility mannequin for controls based mostly on that utilized in .NET 5 and .NET Core. It will require vital rework, nevertheless it ought to end in a design extension that’s prepared for .NET 5 and .NET 6 and new cross-platform applied sciences like MAUI.

Getting your extension code prepared for Visible Studio 2022 shouldn’t be laborious in case you observe Microsoft’s instructions. With side-by-side installs, the method needs to be even simpler as you can also make the required adjustments in Visible Studio 2019, construct your VSIX, after which take a look at in Visible Studio 2022 with out altering improvement PCs.

Copyright © 2021 IDG Communications, Inc.