Blog: 2018 August

Missing SDK when using the Microsoft.Build package in .NET Core

August 31, 2018, (updated on September 1, 2018), Software Development

When I tried to use the Microsoft.Build package in my DNT CLI to read .NET .csproj files in a .NET Core app, I got the following error: Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, It seems that the problem can be fixed by manually setting the MSBUILD_EXE_PATH environment variable. I wrote a simple method which loads the latest installed binary and sets the variable: static void Main(string[] args) { SetMsBuildExePath(); // TODO: Add code } private static void SetMsBuildExePath() { try { var startInfo = new […] Read more...

Tags: ,

  Page 1 of 1