msbuild: Unable to evaluate non SDK style project with Microsoft.Build NuGet package

Issue Description

I have a .Net non SDK style project which I want to evaluate in code using the latest Microsoft.Build NuGet package. I am unable to make it work.

Steps to Reproduce

https://stackoverflow.com/questions/66146972/whats-the-correct-usage-of-microsoft-build-evaluation-fast-forward-to-2021

Versions & Configurations

Microsoft (R) Build Engine version 16.8.2+25e4d540b for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.8.2.56705

I have enterprise edition of VS 2019

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

At the beginning of your app call MSBuildLocator.RegisterDefault() and make sure it’s in a submethod from Main(). It’s important this runs before any MSBuild assemblies attempt to get loaded.