.netwindowspowershellwinget

How to install a particular .NET Framework version SDK using winget?


I tried to install the .NET SDK's for both Framework versions 4.7.2 and 4.8. However, this does not seem possible as there is no way to specify the version, or even get search results with several versions. (Actually the winget package Microsoft.dotNetFramework eventually got me v.4.8.)

I would have expected to be able to find these with:

winget search "SDK"
winget search "DotNet"

But no luck.

I also expected that I could have used something like this:

winget install --id Microsoft.WindowsSDK --version 4.7.2
winget install --id Microsoft.WindowsSDK --version 4.8

But that resulted in nothing, as these packages doesn't have any Id.

Only after a manual install of the ndp472-devpack-enu.exe and ndp48-devpack-enu.exe packages, do they show up.

$ winget.exe list --name "Microsoft .NET"

Name                                                Id                                     Version   Source
------------------------------------------------------------------------------------------------------------
Microsoft .NET Framework 4.8 SDK                    {949C0535-171C-480F-9CF4-D25C9E60FE88} 4.8.03928
Microsoft .NET Framework 4.8 Targeting Pack         {BAAF5851-0759-422D-A1E9-90061B597188} 4.8.03761
Microsoft .NET Framework 4.8 Targeting Pack (ENU)   {A4EA9EE5-7CFF-4C5F-B159-B9B4E5D2BDE2} 4.8.03761
Microsoft .NET Framework 4.7.2 SDK                  {F42C96C1-746B-442A-B58C-9F0FD5F3AB8A} 4.7.03081
Microsoft .NET Framework 4.7.2 Targeting Pack       {1784A8CD-F7FE-47E2-A87D-1F31E7242D0D} 4.7.03062
Microsoft .NET Framework 4.7.2 Targeting Pack (ENU) {B517DBD3-B542-4FC8-9957-FFB2C3E65D1D} 4.7.03062
Microsoft .NET SDK 6.0.402 (x64)                    Microsoft.DotNet.SDK.6                 6.0.402   winget
Microsoft Windows Desktop Runtime - 6.0.10 (x64)    Microsoft.DotNet.DesktopRuntime.6      6.0.10    winget

I'm looking to automate this installation.

So how can I use winget to install a particular .NET Framework version SDK?


Solution

  • You can install a specific version(4.7.2) of .Net framework with below command

    winget install Microsoft.DotNet.Framework.DeveloperPack_4 -v 4.7.2

    enter image description here

    Similar command for latest versions is,
    winget install Microsoft.DotNet.SDK.7 -v 7.0.100

    As per Microsoft

    Windows Package Manager winget command-line tool is bundled with Windows 11 and modern versions of Windows 10(version 1709, build 16299) by default as the App Installer.