Open AndrewRathbun opened 2 years ago
Figure out a way to download the offline installer predictably
dotnet --list-runtimes
Happy to work on this. Are we wanting to check if .net 6 runtime is installed. If not, download and install it? Or are we aiming for something else?
Happy to work on this. Are we wanting to check if .net 6 runtime is installed. If not, download and install it? Or are we aiming for something else?
Yep this is a feature request by @randomaccess3 for exactly that. However, maybe he can chime in as to what would work best for his use case.
I imagine a version checker could be implemented that queries the runtime version installed locally and checks if the current version of .NET 6 is installed. Probably similar logic to the script version checker.
It is a good feature to have. I imagine that there are folks that want to install KAPE and might not even understand what .net is. For my current VMs for the DFIR classes at SANS it is not that useful because my base VM has all these prerequisites, but I still think it adds value to the script.
I imagine a version checker could be implemented that queries the runtime version installed locally and checks if the current version of .NET 6 is installed. Probably similar logic to the script version checker.
winget does this but not in the best way, it just checks if any .net sdk or runtime are installed even if it is different versions (e.g 7 vs Preview ). So if we do go down the winget avenue, be sure to add the --force
switch.
I've got a cheeky one liner in my PowerShell profile for my tool update script:
Start-Process -FilePath pwsh.exe -ArgumentList '-noexit -command "$(@(3,5,6,7,""Preview"").foreach{winget install Microsoft.DotNet.SDK.$($_) --force})"'
If you ever wanted to use something similar :)
To check the dotnet installed, I'd use a combination of winget and Stéphane BARIZIEN's script found here https://gist.github.com/sba923/7924b726fd44af91d18453ee595e6548
$wingetobjects = winget list "Microsoft .NET SDK 6" | cfwo
cfwo
is an alias for ConvertFrom-WingetStdout
which is a very helpfull cmdlet that returns objects from winget output instead of just writing to stdout.
An awesome example of how this can work is: https://user-images.githubusercontent.com/585482/200775771-3caca3d3-9906-40fb-9d5b-ac455c01e217.gif
From Phill Moore (@randomaccess3):
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script