Clarifying the Differences Between SDKs, Workloads, and NuGets in .NET

Mirinimp 20 Reputation points
2024-06-26T08:15:48.8966667+00:00

Could someone explain the differences between .NET SDK, .NET Workloads, and the MAUI NuGets and how they are related to each other? Although I understand SDKs and NuGets, I fail to grasp the purpose of workloads. When am I supposed to update each one? If I update one, should I update the other as well? For instance, if I update from SDK 8.0.100 to 8.0.300, should I also update the other components? A comprehensive overview of the topic would be much appreciated. It would enable us to make our own decisions when faced with updates or when selecting a specific version of the SDK/NuGet/Workload. Thanks.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,578 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 32,306 Reputation points Microsoft Vendor
    2024-06-27T05:53:06.55+00:00

    Hello,

    Could someone explain the differences between .NET SDK, .NET Workloads, and the MAUI NuGets and how they are related to each other?

    The .NET SDK is a set of libraries and tools that developers use to create .NET applications and libraries. .NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. MAUI is a part of .NET, and it's a .NET solution for building native cross-platform apps.

    Please see

    .NET SDK overview - .NET | Microsoft Learn

    What is .NET MAUI? - .NET MAUI | Microsoft Learn

    SDK workloads (maui, maui-mobile, and maui-desktop workloads) are to enable specific developer scenarios on top of the .NET SDK you’ve installed. And the workload will acquire and install all the required SDKs for building .NET MAUI applications.

    Please see Announcing .NET MAUI Preview 6 - .NET Blog (microsoft.com) (This article was old)

    If you create a MAUI project by MAUI template in VS, it will install multiple NuGet packages automatically. Microsoft.Maui.Controls package lets you get started with .NET MAUI. Microsoft.MauiCompatibility package allows for easier migration from Xamarin.Forms.

    For instance, if I update from SDK 8.0.100 to 8.0.300, should I also update the other components?

    Yes. You can open the terminal in VS, then run `dotnet workload update` to get the latest workload.

    (If you install/update the latest VS, the SDK and the workload will update automatically)

    And you can expand the Dependencies->net8.0-ios(or android/maccatalyst/windows)->NuGet->Microsoft.MAUI.Controls, then right-click the package to check if it can be updated.

    Update


    This still holds the other way round? I.e. if I update the NuGets, should I update the workload as well? I mean:

    In a given major SDK release (let's say the .NET 8 release), there are multiple minor releases of said SDK, but also multiple workloads updates and MAUI NuGet packages updates.

    Typically, let's say in a new machine, I install the latest major, stable, SDK version, then install the workloads for said SDK. From that moment on I keep updating the NuGets but not the SDKs nor the workloads. When does it become mandatory to update the workloads again? From what I understand, of course once .NET 9 is the next stable one, one is suppesed to install the .NET 9 SDK (and its workloads) to be able to use the version 9 of the MAUI NuGets. But, do you also get any benefit when building a MAUI app to, let's say, upgrade the SDK + workloads for a fixed MAUI NuGet packages (for instance you have the 8.0.61 release installed and you upgrade the SDK/Workloads)?

    When to update depends on your needs, we recommended that you use the latest version. Some newer versions of the NuGet packages may produce errors if you attempt to install them on older workload and/or SDK versions.

    If you install VS, the SDK and workload are already hosted. When you update VS, they will be update as well. As of .NET 8, MAUI is delivered via NuGet packages. This allows for upgrading or downgrading MAUI while keeping the rest of .NET current.

    (It means that if you just update the NuGet, MAUI part will be update but other .NET part won't)

    It also allows testing preview and nightly builds of MAUI more easily to see if bugs have been fixed. 

    Please see

    https://github.com/dotnet/maui/wiki/Nightly-Builds 

    .NET MAUI Version Pinning & Nightly Build Integration 

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,056 Reputation points
    2024-07-01T15:51:43.2133333+00:00

    sdk - a combination of libraries and tools.

    nuget - is a cloud based repository of installable packages. typically a library or sdk. this is typically part or an individual project and its build process.

    dotnet workload - the dotnet build chain supports workloads. workload is a meta package that defines a set of sdks and dotnet tools to be installed. the dotnet workload command is used to maintain.

    visual studio workload - visual studio also has workloads. these are a meta package of tools to be installed in visual studio to support varies development platforms. may also install a dotnet workload. the visual studio installer is used to maintain visual studio workloads.

    for example:

    dotnet has a maui workload.

    % dotnet workload maui

    this installs the all the support tools and build tools to compile, debug and publish a maui application

    Visual Studio also has a Maui workload. This install the dotnet maui workload, visual studio maui project templates, and visual studio UI tools for compile, debug and publish.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.