问题
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