Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

References in Roslyn .rsp files

Tags:

c#

.net

roslyn

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

like image 921
Doug Finke Avatar asked Oct 25 '11 02:10

Doug Finke


1 Answers

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.

like image 57
Kevin Pilch Avatar answered Sep 16 '22 18:09

Kevin Pilch