Complete the code to print the .NET runtime version installed on your machine.
Console.WriteLine(".NET Runtime Version: " + [1]);
The System.Environment.Version.ToString() method returns the version of the .NET runtime.
Complete the code to create a new console project using the .NET CLI command.
var process = new System.Diagnostics.Process(); process.StartInfo.FileName = "dotnet"; process.StartInfo.Arguments = "[1]"; process.Start();
The correct .NET CLI command to create a new console project is dotnet new console.
Fix the error in the code that tries to check if the .NET SDK is installed by running 'dotnet --version'.
var process = new System.Diagnostics.Process(); process.StartInfo.FileName = "dotnet"; process.StartInfo.Arguments = "[1]"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.Start();
The correct argument to get the .NET SDK version is --version.
Fill both blanks to install the latest .NET SDK using the command line.
string command = "dotnet [1] [2]";
The command dotnet install update is not a valid .NET CLI command. The correct way to install or update the SDK is outside the dotnet CLI, but for this exercise, the blanks expect install and update as placeholders.
Fill all three blanks to check the installed SDK version and print it in C#.
var process = new System.Diagnostics.Process(); process.StartInfo.FileName = "dotnet"; process.StartInfo.Arguments = "[1]"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = [2]; process.Start(); string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); Console.WriteLine("Installed SDK version: " + [3]);
To get the SDK version, run dotnet --version. Redirecting output requires UseShellExecute = false. The output is read into the variable output and printed.