I was working on a project. It was working fine. But when I pulled the latest code then this error was showing. I am using Visual Studio 2017. I can't change it. The project automatically gets unloaded and when I am trying to reload the project then it is giving me the error:
The expression ""AiHandleErrorAttribute.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated. Method 'System.String.GetPathsOfAllDirectoriesAbove' not found. D:\Projects\packages\Microsoft.Net.Compilers.4.2.0\tools\Microsoft.Managed.Core.targets
The screenshots:
Projects get unloaded
When I am trying to reload the project
The dotnet version I am using in project is v4.8
CodePudding user response:
We can see that:
GetPathsOfAllDirectoriesAbove
was introduced in Visual Studio 2019 (16.1). Projects that use it cannot load in Visual Studio 2017.
And this:
The package is indeed restricted to MSBuild 16.3 but the check we are using today isn't using the correct MSBuild property to do the check. This PR fixes the check to be correct.
Also please note Microsoft.Net.Compilers.nupkg is deprecated. Beginning in 16.5 we will no longer be officially producing this anymore. Please migrate to Microsoft.Net.Compilers.Toolset instead.
You can update to VS2019 or VS2022 to solve the problem.