Reputation: 2571
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?
Upvotes: 3
Views: 695
Reputation: 887469
You need to put both Compilation
s' Project
s in the same Solution
, then add a ProjectReference
.
Upvotes: 0
Reputation: 244837
I believe you're looking for the CompilationReference
type, which can be created by calling CSharpCompilation.ToMetadataReference()
.
Upvotes: 3