How do I fix the "Error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found."?

15.9k Views Asked by At

We have searched for a solution to this problem and have had no success...there are plenty of similar errors reported here on around the web and none of the suggestions have worked.

We have a web job project in tfs that compiles fine locally but when we try to build it in devops it fails with the error:

....WebJob.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.

The project targets .NETframework 4.8.
( If I edit the project file the first line shows this which is what the error mentions as the line number(0,0):

<Project Sdk="Microsoft.NET.Sdk;Microsoft.NET.Sdk.Publish"\>

How do I find out what version of Microsoft.net.sdk it's looking for? The devops logged error does not give me that information that I can see.

I looked in that project to see what it references but it does not have any references instead it has Dependencies which has Assemblies and Packages neither of which references any Microsoft.NET.Sdk.

We have installed the .NET Core 3.1.405 (amongst others) and the MS .Net Framework 4.8 developer pack but still no luck.

Any direction on what to try next is appreciated.

1

There are 1 best solutions below

1
DevilDog On BEST ANSWER

Thanks everyone for you help. I was able to figure out what the problem was.

The project had originally been created targeting .NET Core 3.1 I believe and that added the

<Project Sdk="Microsoft.NET.Sdk;Microsoft.NET.Sdk.Publish"\>

at the top of the project file. At some point it was somehow reverted or down targeted to .NET 4.8.

I had to create new projects that targeted .NET4.8 and move all the code to that new projects and the issue went away because that sdk="Microsoft.NET.Sdk" was no longer there.