Roslyn has no reference to System.Runtime

前端 未结 2 2002
面向向阳花
面向向阳花 2021-01-01 12:30

I\'m working on a project where we are using Roslyn to compile some templates for us. Now when I\'m compiling the template I\'m receiving multiple errors in the Compil

2条回答
  •  醉酒成梦
    2021-01-01 12:44

    It appears that you are referencing a PortableClassLibrary. Portable Class Libraries pick up some of the basic types (like object/string/etc) from "System.Runtime.dll". However, in the desktop framework these come from mscorlib.dll. When you use typeof(object).Assembly, you get Roslyn's own version of object. Since Roslyn is not built as Portable Class Libraries, that is the one from mscorlib, and doesn't match the identity of your other references.

提交回复
热议问题