使用&QUOT的AdHocWorkspace结果;语言'C#'是不支持" [英] Using an AdHocWorkspace results in "The language 'C#' is not supported."

查看:294
本文介绍了使用&QUOT的AdHocWorkspace结果;语言'C#'是不支持"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VS2015 Microsoft.CodeAnalysis.CSharp.Workspaces的RC2,该代码会抛出异常:

Using the RC2 of Microsoft.CodeAnalysis.CSharp.Workspaces in VS2015, this code throws an exception:

var tree = CSharpSyntaxTree.ParseText(...);
var workspace = new AdhocWorkspace();
var newRoot = Simplifier.Expand(tree.GetRoot(),
    compilation.GetSemanticModel(tree, false),
    workspace,
    n => true,
    true,
    CancellationToken.None);



异常消息为语言C#不支持。

The exception message is "The language 'C#' is not supported."

我在想什么,使这项工作?

What am I missing to make this work?

推荐答案

您需要添加一个参考 C#工作区的NuGet包。

这将在C#DLL文件复制到你的输出,让罗斯林的MEF扫描仪显示的语言服务。

This will copy the C# DLLs to your output, and let Roslyn's MEF scanner see the language services.

这篇关于使用&QUOT的AdHocWorkspace结果;语言'C#'是不支持"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆