Ordres per instal·lar Microsoft .NET Native Runtime sense preguntes, desinstal·lar-lo i detectar-lo des d’eines de desplegament. Només es mostra una ordre quan és segura: la que indica el manifest o el valor per defecte documentat de la tecnologia de l’instal·lador.
Guia relacionada: Instal·lació silenciosa: MSI, NSIS, Inno Setup · Desinstal·lar un programa amb el registre o PowerShell
Amb winget
winget install --id Microsoft.DotNet.Native.Runtime -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.DotNet.Native.Runtime -e --silentwinget uninstall --id Microsoft.DotNet.Native.Runtime -e --silentPer instal·lador
64 bits · ZIP
Add-AppxPackage -Path Dependencies.zipGet-AppxPackage -Name Microsoft.NET.Native.Runtime.2.2 | Remove-AppxPackageARM64 · ZIP
Add-AppxPackage -Path Dependencies.zipGet-AppxPackage -Name Microsoft.NET.Native.Runtime.2.2 | Remove-AppxPackage32 bits · ZIP
Add-AppxPackage -Path Dependencies.zipGet-AppxPackage -Name Microsoft.NET.Native.Runtime.2.2 | Remove-AppxPackagePowerShell: baixar, verificar, instal·lar
Baixa el fitxer oficial, en comprova l’SHA256 i l’instal·la en mode silenciós.
$url = 'https://github.com/microsoft/busiotools/releases/download/v2.8.0/Dependencies.zip'
$sha256 = '91B666A399CBA3E6D3A6816C80B0422D4BCDAB2A7FBE6F19E6D080B63BDC637F'
$file = Join-Path $env:TEMP 'Dependencies.zip'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file $url = 'https://github.com/microsoft/busiotools/releases/download/v2.8.0/Dependencies.zip'
$sha256 = '91B666A399CBA3E6D3A6816C80B0422D4BCDAB2A7FBE6F19E6D080B63BDC637F'
$file = Join-Path $env:TEMP 'Dependencies.zip'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file $url = 'https://github.com/microsoft/busiotools/releases/download/v2.8.0/Dependencies.zip'
$sha256 = '91B666A399CBA3E6D3A6816C80B0422D4BCDAB2A7FBE6F19E6D080B63BDC637F'
$file = Join-Path $env:TEMP 'Dependencies.zip'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file