I am generating some dynamic C# and want to compile it to a .NET Core App. However, it seems that the deps.json file is missing to make it actually runnable.
So the compiling itself works, but on running dotnet [name of dll] it gives an error:
In code I do
CSharpCompilation compilation = CSharpCompilation.Create(assemblyName,
syntaxTrees: files,
references: references,
options: new CSharpCompilationOptions(OutputKind.ConsoleApplication,
optimizationLevel: OptimizationLevel.Debug
)
);
FileUtility.CreateDirectory(outputDllPath);
EmitResult result = compilation.Emit(outputDllPath, pdbPath: outputPdbPath);
The references collection contains Microsoft.NETCore.App and the netstandard 2.0.0 ref dll, besides other specific dll's that are netstandard2.0 compliant.
This works without errors. On running I get:
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Object' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
How do I produce the correct deps.json file for my compilation?