1

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?

not2qubit
  • 14,531
  • 8
  • 95
  • 135

2 Answers2

5

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.

as-if-i-code
  • 2,103
  • 1
  • 10
  • 19
1

Unfortunately the .NET 4 frameworks do not exist in the winget repository currently. This can be seen by the long string, which is actually the ProductCode for the package, being used as the ID.

If you know the public download links for these versions of the .NET Framework, you can create a PR to submit them on the Winget Community Repository. I recommend using either WingetCreate or the YamlCreate Script to create the manifest.

Trenly
  • 158
  • 6
  • There seem to be some [experimental features](https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md) for `WinGet`, that allows installing both `*.zip` and `*.msi` files, but I haven't used them yet. – not2qubit Dec 02 '22 at 19:55