Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.

The SDK 'Microsoft.NET.Sdk' specified could not be found

Software sucks, every day another bug. Today the bug was in the Visual Studio for Mac package manager.

The bug

I’m rewriting my Slack Profile Bot to use the .NET Generic Host instead of only running as a service on Windows using Topshelf. It’s easy, just add the Microsoft.Extensions.Hosting NuGet package to any .Net Core console app and you’re off.

But no such luck for me. The operation failed with the following error when adding the package:

error MSB4236: The SDK ‘Microsoft.NET.Sdk’ specified could not be found.

Which was weird, since I use this SDK (.Net Core 2.2) on this Mac all day, every day.

The solution

Experienced developer as I am, the first thing I tried was the foolproof method of, wait for it, restarting Visual Studio for Mac. I did it, and lo and behold, the problem disappeared and the package was added successfully.

As always in software, if at first you don’t succeed, reboot.