如何在DNX Core 5.0(ASP.NET 5)中引用执行程序集? [英] How do you reference the executing assembly in DNX Core 5.0 (ASP.NET 5)?

查看:64
本文介绍了如何在DNX Core 5.0(ASP.NET 5)中引用执行程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从.NET 3.5-4.5移植一些代码。在我的程序集中,我有一些代码从当前正在执行的程序集中读取资源。但是, GetExecutingAssembly()不是DNX core 5.0中 Assembly 类型的方法。

I am porting some code from .NET 3.5 - 4.5. Inside of my assembly, I have some code that reads the resource from the currently executing assembly. However, GetExecutingAssembly() isn't a method on the Assembly type in DNX core 5.0.

var xsdStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(xsdPath);

什么等于 Assembly.GetExecutingAssembly()在DNX Core 5.0中?或者,如果我需要一个名称空间来恢复该方法(也许是扩展方法?),那么名称空间是什么?

What is the equivalent of Assembly.GetExecutingAssembly() in DNX core 5.0? Or if I need a namespace to get that method back (an extension method perhaps?), what is the namespace?

推荐答案

typeof(<该程序集中的类型>)。GetTypeInfo()。程序集

这篇关于如何在DNX Core 5.0(ASP.NET 5)中引用执行程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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