Replies: 2 comments
-
No, there is no way to do this. Scripting needs to be able to create scripts that can run in the current process: that means agreeing on things like "where |
Beta Was this translation helpful? Give feedback.
0 replies
-
What I'm looking to do is to prevent users from access the file system by directly accessing the namespace. file-system is an example. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to create a roslyn script using the CSharpScript.Create API such that the script will not have an automatic reference to mscorlib?
Even when I attempt to pass in options overriding the defaults with WithReferences and WithMetadataResolver, OR using a custom MetadataReferenceResolver whose ResolveMissingAssemblies property returns false, and the overridden methods do nothing, even after all that, when I create the Microsoft.CodeAnalysis.Scripting.Script object, subsequently calling the GetCompilation() method on it results in getting Microsoft.CodeAnalysis.Compilation object that has non-empty ExternalReferences property, i.e. mscorelib.dll is in the list.
Literally, the roslyn API is automatically including mscorelib dll when the MetadataReferenceResolver is not configured to not resolve any assemblies. The question is on how to create a compilation object that has an empty set of references rather than the default set.
Beta Was this translation helpful? Give feedback.
All reactions