Feb 09, 2023, 9:48 PM
How to upgrade Ext.NET 5.3 to the latest Newtonsoft.Json release
At the time of writing this guide, the Newtonsoft.Json NuGet package version was 13.0.2. One major version ahead of Ext.NET's referenced 12.0.3.
So, now that there's a major version of the package, must I stick to the old one just because Ext.NET was not built for that?
Well, not really. Updating the NuGet package to the new version works with current Ext.NET without the need of further do!
The steps to upgrade the NuGet package are simple and just a few. This can be done by manually editing the project (
Different approaches of updating NuGet packages in Visual Studio projects are covered by the official Microsoft Visual Studio guide, but if you are in a hurry and using Visual Studio these simple steps might get you up to speed:
1. Right click the project you want to upgrade the NuGet package from, and choose Manage NuGet Packages...
The NuGet packages manager should open, and in a while, show some available NuGet packages to assign to your project. That's not really what we want here, we want to be able to upgrade the Newtonsoft.Json package that should already be installed.
2. Click the Updates tab. It should have a number next indicating how many NuGet packages in the project have found updates.
Note: if you have Include prerelease (next to the search field) checked, the updates will suggest unstable/prerelease package versions if any newer than current version (or latest stable) are available.
3. In the list of packages, scroll down to find the Newtonsoft.Json package. In our example, it currently has 12.0.2 installed, and latest (stable) available just happens to be 13.0.2.
4. Once clicking the NuGet package, the right pane should show further details about the package, as well as a dropdown to allow fine-tuning the version to install. It also tips whether the chosen version is a stable or prerelease one (see figure above).
You may select another version to upgrade to, or just go with whatever version the GUI suggested.
5. Click Update next to the version dropdown.
Visual Studio will perform some checks and present with a change report (this dialog can be disabled so if you once disabled it, VS will just carry on with the update).
6. Confirm by clicking OK
Visual studio will then effectively upgrade the package version and will refresh the GUI, just to reveal Newtonsoft.Json package is no longer there! Of course, if the update was done for the actual latest version.
Any packages that the Nuget Packages Manager GUI sees new versions for will always be in the Updates tab, but changing (downgrading) a version will always be available from the Installed packages tab.
It works?
Now, you should be asking yourself, "but Ext.NET was built for Newtonsoft.Json 12.0.x, why should it work?".
Long story short, the new version of the package does not introduce (at least to this point) any existing feature change that would break how Ext.NET core packages uses it. Furthermore, Visual Studio employs assembly binding that "consolidates" references versions across different dependecies, allowing such to be done.\
There's not guarantee though, that at some point, a package would become incompatible with Ext.NET! So exert extra care when upgrading packages. Always test thoroughly before submitting to production!
Hope this helps!
So, now that there's a major version of the package, must I stick to the old one just because Ext.NET was not built for that?
Well, not really. Updating the NuGet package to the new version works with current Ext.NET without the need of further do!
The steps to upgrade the NuGet package are simple and just a few. This can be done by manually editing the project (
.csproj
) and the packages.json
files, or by using Visual Studio's NuGet Packages Manager GUI, which allows for project-by-project or solution-wide management.Different approaches of updating NuGet packages in Visual Studio projects are covered by the official Microsoft Visual Studio guide, but if you are in a hurry and using Visual Studio these simple steps might get you up to speed:
1. Right click the project you want to upgrade the NuGet package from, and choose Manage NuGet Packages...
The NuGet packages manager should open, and in a while, show some available NuGet packages to assign to your project. That's not really what we want here, we want to be able to upgrade the Newtonsoft.Json package that should already be installed.
2. Click the Updates tab. It should have a number next indicating how many NuGet packages in the project have found updates.
Note: if you have Include prerelease (next to the search field) checked, the updates will suggest unstable/prerelease package versions if any newer than current version (or latest stable) are available.
3. In the list of packages, scroll down to find the Newtonsoft.Json package. In our example, it currently has 12.0.2 installed, and latest (stable) available just happens to be 13.0.2.
4. Once clicking the NuGet package, the right pane should show further details about the package, as well as a dropdown to allow fine-tuning the version to install. It also tips whether the chosen version is a stable or prerelease one (see figure above).
You may select another version to upgrade to, or just go with whatever version the GUI suggested.
5. Click Update next to the version dropdown.
Visual Studio will perform some checks and present with a change report (this dialog can be disabled so if you once disabled it, VS will just carry on with the update).
6. Confirm by clicking OK
Visual studio will then effectively upgrade the package version and will refresh the GUI, just to reveal Newtonsoft.Json package is no longer there! Of course, if the update was done for the actual latest version.
Any packages that the Nuget Packages Manager GUI sees new versions for will always be in the Updates tab, but changing (downgrading) a version will always be available from the Installed packages tab.
It works?
Now, you should be asking yourself, "but Ext.NET was built for Newtonsoft.Json 12.0.x, why should it work?".
Long story short, the new version of the package does not introduce (at least to this point) any existing feature change that would break how Ext.NET core packages uses it. Furthermore, Visual Studio employs assembly binding that "consolidates" references versions across different dependecies, allowing such to be done.\
There's not guarantee though, that at some point, a package would become incompatible with Ext.NET! So exert extra care when upgrading packages. Always test thoroughly before submitting to production!
Hope this helps!
Last edited by fabricio.murta; Feb 09, 2023 at 9:49 PM.
Reason: add link to "assembly binding" term