在罗斯林.rsp文件引用 [英] References in Roslyn .rsp files

查看:229
本文介绍了在罗斯林.rsp文件引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CSharpInteractive.rsp看到你可以在GAC中使用添加引用一个DLL / R:

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

你如何添加引用到自己的DLL?

How do you add references to your own DLLs?

我想System.Reflection.Assembly.LoadFrom,它并没有失败,但没有奏效。

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

我想引用添加到我的DLL有扩展方法。

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

如果我试图直接在交互式窗口中添加了code的扩展方法我得到这个错误:

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

错误CS1109:扩展方法必须在顶级静态类中定义; XYZ是一个嵌套类

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

推荐答案

您应该可以指定一个完整路径,装配,以同样的方式为GAC组件。

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

通常你并不需要,虽然改变的RSP。您可以使用一个定期提交补充参考资料:

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.

这篇关于在罗斯林.rsp文件引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆