I'm trying to implement following csc command based compilation with the Roslyn Microsoft.Codeanalysis library
csc /target:library /out:UserControlBase.dll UserControlBase.cs /addmodule:"c:\artifacts\MyLib.netmodule"
Following is the implementation of the same with Roslyn
var compilation = await project.GetCompilationAsync();
//Add Module
compilation.AddReferences(ModuleMetadata.CreateFromFile(@"c:\artifacts\MyLib.netmodule").GetReference());
compilationStatus = compilation.Emit(outputFolderPath + @"\Test1.dll", outputFolderPath + @"\Test1.pdb");
if (!compilationStatus.Success)
{
foreach (var item in compilationStatus.Diagnostics)
{
Console.WriteLine(item);
}
}
Issue: .Netmodule is not getting added to the project and compilation failed due to references not resolved from netmodule.
Does anyone know the correct way to add this?
I'm using Microsoft.CodeAnalysis 1.0.0