Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of Assembly.GetEntryAssembly() in .NET Core?

In .net framework we could get the starting assembly using:

Assembly.GetEntryAssembly();

But that is removed from .NET Core. Also there is no AppDomain. How can I get access to the entry assembly in .NET Core and Windows Universal applications?

(I need to find all of its embedded resource keys)

like image 822
Paymon Avatar asked Nov 08 '16 09:11

Paymon


People also ask

What is Assembly in NET Core and NET Framework?

In.NET Core and.NET Framework, you can build an assembly from one or more source code files. In.NET Framework, assemblies can contain one or more modules. This allows larger projects to be planned so that several developers can work on separate source code files or modules, which are combined to create a single assembly.

What is the difference between Dot NET assembly and executable?

The .NET assembly is the standard for components developed with the Microsoft.NET. Dot NET assemblies may or may not be executable, i.e., they might exist as the executable (.exe) file or dynamic link library (DLL) file. All the .NET assemblies contain the definition of types, versioning information for the type, meta-data,...

What is the difference between Assembly and framework?

In .NET Core and .NET Framework, you can build an assembly from one or more source code files. In .NET Framework, assemblies can contain one or more modules.

How do I use an assembly in an application?

To use an assembly in an application, you must add a reference to it. Once an assembly is referenced, all the accessible types, properties, methods, and other members of its namespaces are available to your application as if their code were part of your source file. Most assemblies from the .NET Class Library are referenced automatically.


1 Answers

Assembly.GetEntryAssembly() is available in .NET Standard 1.5, but not in versions 1.0 through 1.4. If you are only developing .NET Core and Universal Windows applications, version 1.5 should be sufficient for your needs.

If I remember correctly, AppDomain is destined to appear in .NET Standard 2.0. It is not available now.

like image 89
Anders Gustafsson Avatar answered Nov 24 '22 13:11

Anders Gustafsson