Closed jcurl closed 4 years ago
@rainersigwald should we move this to the MSBuild repository?
Hello, do you have any ideas how I might go ahead and debug this situation?
I recently upgraded the project to .NET 4.8, MSBuild from 16.0.461 to 16.4.0 and the original test code given in this ticket no longer reproduces the problem. Thus, I believe this problem is solved.
Thanks. None of these were related to the original problem, as:
The solution was to upgrade the MSBuild NuGet packages to VS2019, then somehow everything builds properly, including VS2017 (so VS2019 is backwards compatible). Now that it's no longer installed in the GAC, it causes problems that when a user upgrades their tools, my tool will break.
Version Used: VS 16.4.1 with MsBuild 16.4.0 or later
Steps to Reproduce: When loading a project using
Microsoft.Build.ProjectCollection.Load
, get the exception exception of typeMicrosoft.Build.Exceptions.InvalidProjectFileException
with the textThe expression ""Datastructures\ReusableList.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated.
This is introduced with Roslyn Microsoft.Build since 16.4, and was not present in 16.3.
I'm using Microsoft.Build.ProjectCollection from NuGet 16.0.x to load a .csproj (.NET 4.0 and .NET 4.5 projects). I'm setting a few properties as given by Dave Glick on his site https://daveaglick.com/posts/running-a-design-time-build-with-msbuild-apis. With VS2017 15.9.17 and VS2019 16.3.10 I don't have issues.
I was using NuGet packages in my project from 16.0.461, upgraded to 16.4.0 and the problem still exists (Microsoft.Build, Build.Engine, Build.Framework, Build.Utilities.Core) with VS2019 16.4.2 installed.
Specifically, the code I use is:
The goal is I want to iterate through all the items and look for dependencies - I don't need to build, just read the project format and analyze separately the dependency graph.
Expected Behavior: Shouldn't raise an exception
Actual Behavior: I get an exception of type
Microsoft.Build.Exceptions.InvalidProjectFileException
with the textThe expression ""Datastructures\ReusableList.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated. Method 'System.String.GetPathsOfAllDirectoriesAbove' not found. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets.
The last two lines of output is:
It appears to be related to the new functionality for
.editorconfig
, but I don't know enough about MSBuild to determine how to provide it everything it needs prior to properly load.