Q:

Roslyn error on open solution : "Msbuild failed when processing the file 'pathToFile' with message: The path is not of a legal form." How to solve?

I'm trying to analyze some solutions with Roslyn and use a standard code for opening solution:
var msWorkspace = MSBuildWorkspace.Create();
var solution = msWorkspace.OpenSolutionAsync(path).Result;     

The problem is projects in solutions aren't opened, and msWorkspace.Diagnostics property contains one Failure Diagnostics:

Msbuild failed when processing the file 'csprojPath' with message: The
  path is not of a legal form.

Classic solutions or standard - the same Failure Diagnostic is shown. 
Lib is used: Microsoft.CodeAnalysis.Workspaces, Version=2.7.0.0
I've checked a path - everything looks fine (tested 5 of them).
Could someone help with solving this issue?
Upd1 Tested on the default VS desktop console app, got a failure Diagnostic:
Msbuild failed when processing the file 'C:\Tests\ClassicConsole\ClassicConsole\ClassicConsole.csproj' with message: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets: (84, 5): The "Csc" task could not be instantiated from the assembly "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.CodeAnalysis.BuildTasks.Csc' to type 'Microsoft.Build.Framework.ITask'.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets: (84, 5): The "Csc" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.

A:

Matt Warren's answer from this question helped: it was enough add "bindingRedirect" section to my app.config from MsBuild.exe.config . 

