Created
August 17, 2014 12:19
-
-
Save Fhernd/a33c91f3778e80c17327 to your computer and use it in GitHub Desktop.
Obtención del nombre de directorio de un assembly en ejecución.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Reflection; | |
namespace Articulos.Pregunta.P0420 | |
{ | |
public sealed class ObtencionUbicacionAssembly | |
{ | |
public static void Main() | |
{ | |
// Título aplicación consola: | |
Console.Title = "--- Obtención Ubicación Assembly en Ejecución ---"; | |
Console.WriteLine (); | |
// Obtención de la ubicación en disco del assebmly | |
// que se encuentra en ejecución: | |
string ubicacion = Assembly.GetExecutingAssembly().Location; | |
// Presentación en pantalla del nombre del directorio | |
// en el que se está ejecutando el assembly: | |
Console.WriteLine ("Directorio de ejecución del assembly: {0}", | |
Path.GetDirectoryName(ubicacion) | |
); | |
// Espera a que el usuario presione la tecla | |
// Enter para finalizar completamente la aplicación: | |
Console.WriteLine ("\nPresione la tecla `Enter` para finalizar."); | |
Console.ReadLine (); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment