¿Cómo puedo encontrar el nombre completo de una asamblea?


¿Cómo puedo encontrar el nombre completo de mi asamblea tal como:

MyNamespace.MyAssembly, version=1.0.3300.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089

He logrado obtener mi PublicKeyToken usando el sn.exe en el SDK, pero me gustaría obtener fácilmente el nombre completo calificado.

Author: starblue, 2009-03-18

9 answers

Si puede cargar el ensamblado en una aplicación. NET, puede hacer:

typeof(SomeTypeInTheAssembly).Assembly.FullName

Si no puedes entonces puedes usar ildasm.exe y estará allí en algún lugar:

ildasm.exe MyAssembly.dll /text
 26
Author: Hallgrim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-03-18 14:56:36

Este es un descarado copy-paste de Lo anoto y es una forma sencilla de obtener el FQN para la salida del proyecto:

Open Visual Studio
Go to Tools –> External Tools –> Add
    Title: Get Qualified Assembly Name
    Command: Powershell.exe
    Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"
    Check "Use Output Window".

La nueva herramienta aparece en Tools –> Get Qualified Assembly Name. Cuando se selecciona el elemento de menú, el nombre del ensamblado aparece en la ventana de salida.

 116
Author: David Clarke,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-04 21:09:46

Llegó tarde a la fiesta, pero buscó en Google un poco más sobre este tema y encontró esta página:

Describe una función de powershell que puede hacer esto. Tan. Nunca antes había usado powershell, pero pensé en intentarlo:

C:\> cd PATH_TO_ASSEMBLY   
C:\PATH_TO_ASSEMBLY>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\PATH_TO_ASSEMBLY> [System.Reflection.AssemblyName]::GetAssemblyName('System.Data.SQLite.dll').FullName
System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
PS C:\PATH_TO_ASSEMBLY>

Esto hace el truco mencionado en otras respuestas mediante el uso de código, excepto que no tiene que crear un proyecto para hacer esto, simplemente escriba prompt;)

 23
Author: Daren Thomas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-07 12:01:50

Use Ensamblado.GetExecutingAssembly () para obtener el ensamblado actual, utilice Assembly.GetEntryAssembly () para obtener el ensamblado que lo inició todo, o use Assembly.GetCallingAssembly () para obtener el ensamblado del código que llamó a su función (uno en la pila).

Una vez que tenga el ensamblado correcto, use la propiedad FullName, como se indica en otras respuestas.

 9
Author: Dave Van den Eynde,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-03-18 14:27:44

Además, si está buscando el Nombre Completo para un ensamblado ya en el GAC, puede iniciar un Símbolo del sistema de Visual Studio (la forma más fácil de establecer las rutas correctas) y usar gacutil /l para listar todos los ensamblados con sus respectivos FQNs. Usa gacutil /l <yourassemblyname> para filtrar la lista y encontrar más fácilmente lo que estás buscando.

 6
Author: Per Noalt,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-16 16:20:27

Si carga el ensamblado (DLL, EXE, etc.) en Reflector te dirá el nombre completo en la parte inferior.

 5
Author: Richard Slater,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-03-18 14:25:15

También puede usar ILSpy de código abierto, después de cargar su ensamblado, su nombre completo será diplayed en comentarios en la parte superior de la ventana de código

 5
Author: csharpfolk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-27 09:52:46

JetBrains dotPeek o Telerik JustDecompile son bastante buenas. Simplemente abra el DLL y tendrá el nombre de inmediato.

 4
Author: uli78,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-14 15:27:04

Un par de maneras.

En el código:

Asamblea.FullName por ejemplo,

typeof(Thingy).Assembly.FullName

O, si es un ensamblaje instalado, desde el GAC usando los pasos en este post en msdn.

 0
Author: joshua.ewer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-03-18 14:26:11