Hawk
Hawk
CC#
Created by Hawk on 8/30/2023 in #help
❔ CSharpCompilation using Roslyn
Hello there I’m trying to build a console executable programmatically using Roselyn api. Both the application building and the built application target .net 6. I’m using PreserveCompilationContext and DependencyContext.Default.CombineLibraries to get the references to pass to CSharpCompilation.Create but I get an error at runtime saying the executable cannot load System.Runtime. The file is located in the refs/ folder along the application building and the I believe the references are being used during the build but they are not being loaded at runtime. Do I need to specify the path to where the executable can find the assemblies at runtime? How come can’t it find them? Thanks
4 replies