You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to using the CompilationDependencyResolver for my own script runner but the scripts don't compile due to it not knowing what System.Object or System.Void is.
I naively tried:
Dotnet.Script.DependencyModel.Logging.LogFactorylogFactory=(t)=>(l,m,e)=>Log.WriteLine(m);dependencyResolver=newCompilationDependencyResolver(logFactory);//...usingvarfile=File.Open(scriptFileName,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);usingvarloader=newInteractiveAssemblyLoader();vardependencies=dependencyResolver.GetDependencies(path,new[]{scriptFileName},true,"netcoreapp3.1");varassemblyReferences=dependencies.SelectMany(d =>d.AssemblyPaths).ToArray();varscriptOptions=ScriptOptions.Default.WithFilePath(scriptFileName).WithMetadataResolver(newNuGetMetadataReferenceResolver(ScriptOptions.Default.MetadataResolver)).WithReferences(assemblyReferences)//.WithReferences(AssemblyReferences) - I was manually adding assemblies in the past.WithEmitDebugInformation(enableDebugging);varscript=CSharpScript.Create<SkiaPadScript>(file,scriptOptions,assemblyLoader:loader);ScriptState<SkiaPadScript>result=awaitscript.RunAsync();
The text was updated successfully, but these errors were encountered:
dfkeenan
changed the title
How to run a script using CompilationDependencyResolver
How to run a script using CompilationDependencyResolver?
Feb 22, 2020
Compilation dependencies are used by OmniSharp to provide language services like Intellisense. It is the runtime dependencies you need to compile and run a script
Hi,
I am trying to using the CompilationDependencyResolver for my own script runner but the scripts don't compile due to it not knowing what
System.Object
orSystem.Void
is.I naively tried:
My application targets
netcoreapp3.1
.The script I am testing with is:
Any help would be greatly appreciated.
Thanks,
Daniel
The text was updated successfully, but these errors were encountered: