How to Find the Fully Qualified Name of an Assembly

How do I find the fully qualified name of an assembly?

If you can load the assembly into a .NET application, you can do:

typeof(SomeTypeInTheAssembly).Assembly.FullName

If you cannot then you can use ildasm.exe and it will be in there somewhere:

ildasm.exe MyAssembly.dll /text

How to get fully qualified assembly name

This article (How to: Determine an Assembly's Fully Qualified Name
) will probably help you


Code from MSDN

//s if the Fully Qualified assembly name
Type t = typeof(System.Data.DataSet);
string s = t.Assembly.FullName.ToString();

How can I retrieve an assembly's qualified type name?

This is a nice handy tool (shell extension with source code) for copying the fully qualified name to clipboard by right clicking on any assembly.

Update: After seeing the comment from dance2die, thought of putting together a sample powershell script to export the type name to a csv file.

> [System.Reflection.Assembly]::LoadWithPartialName("System.Web")

> [System.Web.Security.SqlMembershipProvider] | select {$_.UnderlyingSystemType.AssemblyQualifiedName } | export-csv c:\typenames.csv

Using C#, if you want to generate the assembly qualified type name with all the references set, it is easy to build a test script using reflection..

using System;
using System.Reflection;
........

Type ty = typeof(System.Web.Security.SqlMembershipProvider);
string fullname = ty.AssemblyQualifiedName;
//"System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

Getting the Assembly Qualified Name of a class in Visual Studio

I'm gonna change my comment to a proper answer, because after having a quick play what i suggested does exactly what you want.

Download the free version of Reflector from here, unpack it and run it. Drag and drop a compiled version of your assembly on to it, and next to the Name tag in the info section at the bottom of the dialog will be its fully qualified name, ready for you to just copy and paste from there.

Note that all the info you need is also availableby right-clicking on the compiled file, select Properties, then go to the Details tab, although you can't just copy/paste from there.

How to get the assembly name(not qualified name) from type(only assembly name without version or culture or publickeyToken) in c#

To get simple name of the assembly, try

typeof(MyClass).Assembly.GetName().Name

How to get Fully Qualified Name of a Type using Reflection in C#

You can load all the active assemblies in the app domain, then walk each assembly's types looking for a name match. Without the assembly name though, you can't use Type.GetType() as you saw.

The following simple program works for me.

class Program
{
static void Main(string[] args)
{
Console.WriteLine(GetFqTypeName("IMyInterface"));
Console.ReadKey();
}

static String GetFqTypeName(string shortTypeName)
{
return AppDomain.CurrentDomain.GetAssemblies()
.ToList()
.SelectMany(x => x.GetTypes())
.Where(x => x.Name == shortTypeName)
.Select(x => x.FullName)
.FirstOrDefault();
}
}

public interface IMyInterface { }

Get loaded assembly based on Full Qualified Name

You would use AssemblyName for parsing the string from your config file and I guess you'll get the assemblies loaded in the app domain and filter them comparing the assembly name from config with the result from the assemblies' Assembly.GetName method.



Related Topics



Leave a reply



Submit