Setting MSBuildToolsPath for Roslyn

Viewed 1284

I am trying to compile a C# solution/project with Roslyn using .NET Core and an EAP build of Rider.

I can compile the solution/project using Rider successfully.

When I try to use Roslyn, I am able to create the workspace, add the solution, and find the project, but the compilation step fails. The diagnostic message inside the workspace says:

[Failure] Msbuild failed when processing the file 'C:\Path\To\Solution.csproj' with message: The imported project "C:\Program Files\dotnet\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\Path\To\Solution.csproj

The answer to a similar question at https://stackoverflow.com/a/5695 suggests modifying the project file directly, replacing MSBuildToolsPath with MSBuildBinPath. However, it may not be possible for me to modify the <Import> line in the project.

Is there another way to have Roslyn find the correct path for the Microsoft.CSharp.targets file?

0 Answers
Related