Detecting your installed .net core version by console

If want to check which .net core version, sdk’s and runtimes are installed on your machine you can easily check in console by typing:

dotnet --info

You will get a result looking like:

Getting .net core infos in console
Getting .net core infos in console

Like mentioned in the result you can install another version or sdk by visiting https://aka.ms/dotnet-download and following the instructions or do it directly in visual studio.

There you have to open the project properties and select the targetframework dropdown. You can find an option named install another framework there. By clicking on it the browser opens and you’ll be transfered to https://dotnet.microsoft.com/download/visual-studio-sdks where you can download runtimes and sdk’s.

Ausgabe von Deutschen Tagesbezeichnungen eines DateTime Objektes

Die einfachste Möglichkeit um in C# aus einem DateTime Objekt den Deutschen Tagesnamen zu erhalten ist die Benutzung des Formats „dddd“ in Kombination mit der CultureInfo „de-DE“. Als Beispieldatum nehmen wir den 01.01.2020, welcher ein Mittwoch ist.

Der Code zur Ermittlung der Wochentagsbezeichnung sähe dann wie folgt aus:


var tagesName = new DateTime(2020, 1, 1).ToString("dddd", CultureInfo.CreateSpecificCulture("de-DE")); //liefert den string "Mittwoch"

Ein klarer Vorteil dieser Methode gegenüber beispielsweise einer Ermittlung per Unix Timestamp ist, dass man sich keine Sorgen um die Zeitzonen machen muss.

Weitere Infos zur Konvertierung von Datumsformaten in C# findet ihr unter: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings