I want to include an already existing CSharpCompilation object into a new CSharpCompilation object. Similar to project-to-project references in c#. My current solution is to include the syntax trees of the first compilation in the new compilation, but that gives problems when I need to compare Symbols in both compilations (they are not the same). MetadataReference.CreateFrom...(), doesn't contain an overload for Compilation. Is this possible somehow?
我相信您正在寻找CompilationReference
类型,它可以通过调用CSharpCompilation.ToMetadataReference()
创建。
您需要将两个Compilation
的Project
放在同一个Solution
,然后添加一个ProjectReference
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.