MSBuildWorkspace.Create () - Supported languages ​​vanish

I am using the roslyn method of Formatter.Format Formatter.Format() to format some C #.

One of the parameters accepts a Workspace object that can be created using MSBuildWorkspace.Create() .

However, when I run the code, I get an exception at runtime because the workspace returns without supported languages. If I run this in a console application, it works fine.

Any ideas?

+6
source share
1 answer

Be sure to deploy Microsoft.CodeAnalysis.CSharp.Workspaces.dll and / or Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll with your application.

The workspace dynamically detects which languages ​​it supports in loading these assemblies.

+6
source

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


All Articles