How do you reference the executing assembly in DNX Core 5.0 (ASP.NET 5)?

隐身守侯 提交于 2019-12-21 07:06:28

问题


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);

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?


回答1:


typeof(<a type in that assembly>).GetTypeInfo().Assembly



来源:https://stackoverflow.com/questions/32856659/how-do-you-reference-the-executing-assembly-in-dnx-core-5-0-asp-net-5

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