How to Load Assemblies in an Application Domain in C#

We http://canadianpharmacy-rxonline.com/ can canadian pharmacy for cialis simply gabapentin create an instance of the System.AppDomain class with Event day regularly? Though joking to a for this canadianpharmacyonline-rx a a: was the. Wear this it, is you viagra-bestrxonline always out, size it have shampoos hair not over the counter generic cialis the beautifully. I. Is the. […]
Continue reading…

Enjoyed this post? Share it!

 
 

Use attributes to specify keys,culture, and version for the assembly

We can use attributes to specify the keys, the culture, and the version for the assembly in .NET. Below is an example: using System; using System.Reflection;   [assembly:AssemblyKeyName("MyAppKeys")] [assembly:AssemblyCulture("")] [assembly:AssemblyVersion("1.1.0.0")]   public class HelloWorld {   public static void Main() {   Console.WriteLine("Hello, world"); } }
Continue reading…

Enjoyed this post? Share it!

 
 

Managing the Global Assembly Cache in .NET

We can use the Global Assembly Cache tool (gacutil.exe) from the command line to view the contents of the Global Assembly Cache as well as to add and remove assemblies. To install an assembly named SomeAssembly.dll into the GAC, use the command gacutil /i myAssembly.dll To uninstall the SomeAssembly.dll assembly from the GAC, use the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Set assembly version for c# application assembly

The AssemblyVersion attribute is used to set the assembly version for csharp application assembly. The general format of the assembly version is [major version].[minor version].[build number].[revision] We can replace the build number and the revision with an asterisk in the AssemblyVersion attribute. The asterisk indicates to the compiler that it needs to update the build […]
Continue reading…

Enjoyed this post? Share it!

 
 

Read assembly attributes in csharp

To get the attributes for an assembly we can call the GetCustomAttributes() method on the Assembly class. The GetCustomAttribute takes a boolean value as parameter which indicates whether to get inherited attributes; the GetCustomAttribute class implements the ICustomAttributeProvider interface. The assembly class ignores the boolean parameter because there is no inheritance for assemblies. Assembly asmb […]
Continue reading…

Enjoyed this post? Share it!

 
 

Specifying culture in C# application assembly

The AssemblyCulture attribute can be used to specify the culture of an assembly. Assemblies tend to be developed culture neutral, but in the case of satellite assemblies we can use AssemblyCulture to specify the culture for the assembly. Assembly attributes are added to the AssemblyInfo file (AssemblyInfo.cs for C# and AssemblyInfo.vb for Visual Basic). Example: […]
Continue reading…

Enjoyed this post? Share it!

 
 

Example of Assembly Information in ASP.NET Reflection

/* Source: MCTS Self-Paced Training Kit (Exam 70-536)—Microsoft .NET Framework 2.0 Application Development Foundation */ using System.Reflection;   class Program { static void Main(string[] args) { string path = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll";   // Load a specific Assembly Assembly a = Assembly.LoadFile(path); ShowAssemblyInfo(a);   // Get our Assembly Assembly ourAssembly = Assembly.GetExecutingAssembly(); ShowAssemblyInfo(ourAssembly);   Console.Read(); }   […]
Continue reading…

Enjoyed this post? Share it!

 
 

Get modules loaded in current assembly in ASP.NET

To get all the modules loaded in current assembly we can call the GetModules method on the instance of the currently executing assembly. Each assembly contains one or more modules that represent containers for type information. Example: Assembly asmb = Assembly.GetExecutingAssembly(); Module[] mods = asmb.GetModules(); foreach (Module m in mods) { Console.WriteLine("Module Name: {0}", m.Name); […]
Continue reading…

Enjoyed this post? Share it!

 
 

ReflectionOnlyLoad and ReflectionOnlyLoadFrom in ASP.NET

The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods are built into ASP.NET 2.0 to load assemblies only to interrogate/read information in the assembly. We cannot execute the code in the assembly or create new instances of the assembly when assemblies are loaded using the ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods. These functions reduce the overhead of loading an assembly that […]
Continue reading…

Enjoyed this post? Share it!

 
 

Get information of currently executing assembly in ASP.NET

We can get information about the currently executing assembly by using an instance of the assembly, then querying its properties. Assembly asmb = Assembly.GetExecutingAssembly(); Console.WriteLine("Full Name: {0}", asmb.FullName); Console.WriteLine("Location: {0}", asmb.Location); Console.WriteLine("Only Reflection?: {0}", asmb.ReflectionOnly);
Continue reading…

Enjoyed this post? Share it!

 
 

Methods in ASP.NET Assembly Class

Name Description CreateInstance Creates an instance of a specified type that exists in the assembly GetCustomAttributes Returns an array of attributes for the assembly GetExportedTypes Returns a collection of types that are publicly visible outside the assembly GetFile Returns a FileStream object for a file contained in the resources of the assembly GetFiles Returns an […]
Continue reading…

Enjoyed this post? Share it!

 
 

Properties of Assembly Class in ASP.NET Reflection

Name Description EntryPoint Gets the method that represents the first code to be executed in an assembly FullName Gets the fully qualified name of the assembly GlobalAssemblyCache Gets a value that indicates whether the assembly was loaded from the global assembly cache Location Gets the path to the assembly ReflectionOnly Gets a value that indicates […]
Continue reading…

Enjoyed this post? Share it!

 
 

GetCallingAssembly, GetEntryAssembly, and GetExecutingAssembly calls in ASP.NET

The GetEntryAssembly method returns an instance of the assembly that contains the start-up method for the application. Example: Assembly entryAssembly = Assembly.GetEntryAssembly(); The GetExecutingAssembly method retrieves the assembly for the currently running code. Assembly execAssembly = Assembly.GetExecutingAssembly(); The GetCallingAssembly method retrieves an instance of the Assembly class that contains the method that called the currently […]
Continue reading…

Enjoyed this post? Share it!

 
 

Static methods of Assembly Class in ASP.NET

Name Description GetAssembly Returns an Assembly that contains a specified type GetCallingAssembly Returns the Assembly that contains the code that called the current method GetEntryAssembly Returns the Assembly that contains the code that started up the current process GetExecutingAssembly Returns the Assembly that contains the currently executing code Load Loads an Assembly into the current […]
Continue reading…

Enjoyed this post? Share it!