Question

I see in the CSharpInteractive.rsp you can add a reference to a DLL in the GAC using /r:

How do you add references to your own DLLs?

I tried System.Reflection.Assembly.LoadFrom, it didn't fail but didn't work.

I am trying to add a reference to my DLL that has extension methods.

If I try to add the code for the extension method directly in the interactive window I get this error:

error CS1109: Extension methods must be defined in a top level static class; XYZ is a nested class

Was it helpful?

Solution

You should be able to specify a full path for the assembly, in the same way as the gac assembly.

Normally you don't need to change the rsp though. You can add references in a regular submission using:

#r "path"

Disclaimer: I work at Microsoft on the Roslyn team.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top