I am using the roslyn Formatter.Format()
method to format some c#.
One of the parameters takes a Workspace
object which can be created using MSBuildWorkspace.Create()
.
However, when I run the code I get a runtime exception because the workspace comes back with no supported languages. If I run this in console application it works fine.
Any ideas?
Make sure to deploy Microsoft.CodeAnalysis.CSharp.Workspaces.dll and/or Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll with your app.
The workspace dynamically discovers which languages it has support for by loading those assemblies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With