Blog: MSBuild

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: ,

Implement custom MSBuild tasks and distribute them via NuGet

January 31, 2017, (updated on May 15, 2018), 5 comments, Software Development

In this article describes how to implement MSBuild tasks with inline C# or in an external .NET assembly. After doing so, we will bundle these tasks in a NuGet package, so that they can easily be distributed and updated via NuGet and executed as part of the MSBuild compilation process. This is a powerfull technique to share and manage MSBuild tasks (e.g. build scripts, code generators, etc.) in bigger environments (enterprises, open-source libraries, common/shared tasks). Write simple task with inline C First we implement an MSBuild task with inline C# code. For the purpose of this article, a simple “Hello […] Read more...

Tags: , , ,


  Page 1 of 1