Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 889
NightOwl888 Avatar asked Sep 30 '15 02:09

NightOwl888


1 Answers

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

like image 169
Victor Hurdugaci Avatar answered Nov 04 '22 23:11

Victor Hurdugaci