Skip to content

Commit

Permalink
Add our own assembly to MEF
Browse files Browse the repository at this point in the history
This allow to IL-Merge roslyn workspaces layer in our assembly.

Related to #12
  • Loading branch information
vbfox committed Mar 2, 2016
1 parent f10bc37 commit 6550513
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/BlackFox.Stidgen/CsharpGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,20 @@ let makeRootNode (idTypes : IdType seq) =

module DocumentGeneration =
open System.Reflection
open Microsoft.CodeAnalysis.Host.Mef

let private createWorkspace () =
// Our own assembly is added to the list as when IL-merged it's where all the
// roslyn classes will be.
let assemblies =
MefHostServices.DefaultAssemblies
|> Seq.append [ Assembly.GetExecutingAssembly() ]

let hostServices = MefHostServices.Create(assemblies)
new AdhocWorkspace(hostServices)

let private makeDocument (assemblies: Assembly seq) (rootNode:SyntaxNode) =
let workspace = new AdhocWorkspace()
let workspace = createWorkspace ()
let project = workspace.AddProject("MyProject", LanguageNames.CSharp)

let project =
Expand Down

0 comments on commit 6550513

Please sign in to comment.