How to access the complete solution using Roslyn?

I am trying to access a complete design solution from a console application in Roslyn. I meant this walkthrough . I installed all the appropriate build tools.

This is my code:

using Microsoft.CodeAnalysis.MSBuild; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { string solutionPath = @"C:\Users\Administrator\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1.sln"; var workspace = MSBuildWorkspace.Create(); //This line throws the exception var solution = workspace.OpenSolutionAsync(solutionPath).Result; } } } 

This gives the following exception:

An unhandled exception of type "System.IO.FileNotFoundException" occurred in Microsoft.CodeAnalysis.Workspaces.Desktop.dll

Additional information: Failed to load file or assembly 'System.Composition.TypedParts, Version = 1.0.27.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the specified file.

+6
source share

Source: https://habr.com/ru/post/989721/


All Articles