1

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.

Ramil Aliyev 007
  • 4,437
  • 2
  • 31
  • 47
DevilDog
  • 413
  • 2
  • 7
  • 16
  • MSBuild 15 or 16 is needed, but you probably forgot to install that and configure the job to use it. – Lex Li Jan 25 '21 at 20:47
  • Lex Li, thanks for the reply...I checked with the devops contact and he says VS 2017 is installed on that server...which I believe is MSBuild 15? – DevilDog Jan 25 '21 at 22:38
  • Due to the design change, https://blog.lextudio.com/the-rough-history-of-msbuild-cc72a217fa98 even with VS 2017 installed, your TFS job might use a very old MSBuild version instead. So please dig further into the build log and see what exactly is being used. – Lex Li Jan 25 '21 at 22:42
  • I checked the log and the 5th line down is below which seems to show it's using MSBuild 15: [command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "e:\ADO Server Agent\Agent\_work\34\s\...." – DevilDog Jan 26 '21 at 02:11
  • Then very likely you hit another famous issue that VS2017/MSBuild 15 requires a different series of .NET Core 3.1 SDK (3.1.111 for instance), https://dotnet.microsoft.com/download/dotnet-core/3.1 and does not work with 3.1.405. – Lex Li Jan 26 '21 at 03:10
  • What task are you using? Can you also enable system diagnostics and share the complete build logs for further troubleshooting? – Walter Jan 26 '21 at 06:12

1 Answers1

1

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.

Ramil Aliyev 007
  • 4,437
  • 2
  • 31
  • 47
DevilDog
  • 413
  • 2
  • 7
  • 16