References in Roslyn .rsp files

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 10:46:48

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/7883967/references-in-roslyn-rsp-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!