次の方法で共有


Assembly Display Names

An assembly display name should include the assembly simple name, version, culture and public key token. The assembly simple name is usually the file name of the assembly without the extension (“.dll” or “.exe”).

For example, the assembly display name for the v1.0 system.dll assembly is:

System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

All of those components are required to be specified in calls to Assembly.Load() if the assembly is to be found in the GAC (and I strongly recommend that you always specify them, even if the assembly is not in the GAC).

My plea: please don’t put together these names yourself. Allow Fusion to create them for you so that they will be canonicalized and work with upcoming (and past) versions of Fusion. If you need to get one programmatically, try Assembly.FullName, AssemblyName.FullName, or Type.AssemblyQualifiedName. If you just need to cut-and-paste one into your code, “gacutil /l” is a quick way to get the official string. If you just need the public key/token, try “sn -Tp”.

Comments

  • Anonymous
    June 28, 2003
    It is great to read your blogs. It is very informational! Thanks for your effort.Could you please say something more about canonicalizing process in Fusion? Thanks,--L.

  • Anonymous
    June 30, 2003
    The comment has been removed

  • Anonymous
    July 22, 2003
    The comment has been removed

  • Anonymous
    July 23, 2003
    The comment has been removed

  • Anonymous
    July 29, 2003
    Yes, set those properties on an AssemblyName object, and then get its FullName property. Going the other direction is supported starting in v2.0 - the AssemblyName(String) constructor takes an assembly display name, and then the resulting AssemblyName will have the parsed properties.

  • Anonymous
    March 24, 2004
    In .NET 1.0, in which scenarios will Assembly.FullName return a string that doesn't contain version, culture, or publicKeyToken?

  • Anonymous
    March 29, 2004
    The comment has been removed

  • Anonymous
    May 16, 2004
    I am trying to use the function Assembly.gettype. But my system does not show any such function. Please let me know what is hapening.

  • Anonymous
    June 02, 2004
    It's System.Reflection.Assembly.GetType() in mscorlib.dll, and these are the different overloads, below. See MSDN for more info.

    Type GetType(String name)
    Type GetType(String name, bool throwOnError)
    Type GetType(String name, bool throwOnError, bool ignoreCase)
    Type GetType()

  • Anonymous
    April 19, 2005
    The comment has been removed

  • Anonymous
    April 25, 2006
    hi i love u

  • Anonymous
    May 21, 2006
    I'm generating an assembly using CSharpCodeProvider compile method. I use in my code, in another project (not using reflection) Types from this generated assembly. In this second project I'm loading the generated assembly unsing Assembly.Load(byte[] bytes) method. But when the code want to load Types from this assembly .net tries to load again the generated assembly from the file system. Why? This assembly is already loaded by the previous call to Assembly.Load(). Can anybody help me?
    Thanks,

    Daniel

  • Anonymous
    April 12, 2007
    An unmanaged dll can be wrapped in a managed assembly by adding it as a file of a multi-module assembly.

  • Anonymous
    April 12, 2007
    Calling Load(AssemblyName) is not necessarily the same as calling Load(String). If the AssemblyName.CodeBase

  • Anonymous
    April 12, 2007
    Pre-v2, when you load an assembly by path through Fusion (LoadFrom(), ExecuteAssembly(), etc.), it can

  • Anonymous
    April 12, 2007
    By "Frameworks assemblies," I mean the assemblies that ship with the CLR. But, I'm not counting mscorlib.dll

  • Anonymous
    April 12, 2007
    There are two types of assembly identity that the loader deals with: bind-time and after bind-time. The

  • Anonymous
    April 12, 2007
    So, after checking out the binding context options , you've decided to switch your app to use the Load

  • Anonymous
    April 12, 2007
    A partial bind is when only part of the assembly display name is given when loading an assembly. Assembly.LoadWithPartialName()

  • Anonymous
    April 12, 2007
    If no assembly is specified, Type.GetType() will only look in the calling assembly and then mscorlib.dll

  • Anonymous
    July 03, 2007
    I have an assembly call it MyAssembly.dll. In it there is a type under the namespace MyCompany.Service.MyServices that is MyService. What is the full CLR type name for this type? Thank you. Kevin

  • Anonymous
    February 02, 2009
    Is there any way (SomeMethod) I can find an assembly's fully qualified name from just it's name given as a string? Let me explain my question with an example: string DisplayName = "Microsoft.Msagl"; string FullyQualifiedName = SomeMethod (DisplayName); and FullyQualifiedName would hold: "Microsoft.Msagl,Version=1.2.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" Thanks in advance.

  • Anonymous
    February 10, 2009
    Hi everyone, Thanks for posting my feedback. I got a solution to my problem and sharing with you: The following code actually finds the fully qualified name, if the file location is provided: Assembly asm = Assembly.LoadFrom("C:\Program Files\Microsoft Pex\bin\Microsoft.Msagl.dll");            Dataflow.BasicBlock("Microsoft.Msagl.Anchor," + asm.FullName.ToString()); The Assembly "asm.FullName" gives the fully qualified name. (Ignore Dataflow.BasicBlock: this some library that I was working on) I got this helpful piece code from: http://www.hanselman.com/blog/OutputAnAssemblyVersionFullyQualifiedNameFromTheCommandLine.aspx Thanks. --Ishtiaque