Click here to Skip to main content

.NET Framework

GeneralRe: Deployment question PinmemberJoltWork21-Feb-07 2:24 
GeneralRe: Deployment question PinprotectorHeath Stewart21-Feb-07 4:13 
GeneralRe: Deployment question PinmemberJoltWork21-Feb-07 6:19 
AnswerRe: Deployment question Pinmemberperlmunger21-Feb-07 7:01 
If you create your own project installer (System.Configuration.Install.Installer), you can easily get the install path by just using reflection on the executing assembly. Here is some code I use to do this in my installer:
/// Since this assembly is being run from the install directory, it will return the full
/// path to this assembly. You can simple get the directory path using a FileInfo object
/// to know where it's been installed.
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
string baseAppDir = (new System.IO.FileInfo( asm.Location )).DirectoryName;
/// We're certain this exists because our setup program created it.
RegistryKey softwareKey = Microsoft.Win32.Registry.LocalMachine
               .OpenSubKey( "Software", true )
               .OpenSubKey( "Company Name", true )
               .OpenSubKey( "Application Name", true );
softwareKey.SetValue( "InstallLocation", configFilepath );
Keep in mind that I added a registry value in setup project that creates the HKLM\Software\Company Name\Application Name\InstallLocation key with some default or empty value. The setup project actually creates the keys you specified in the registry editor part of the setup project before it calls your code in the Installer class.
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall

QuestionTransaction on Dataset in Pinmemberneerajxp15-Feb-07 5:35 
AnswerRe: Transaction on Dataset in PinmvpColin Angus Mackay15-Feb-07 6:03 
QuestionGeneric Signatures on remoting objects PinmemberLukeHammond15-Feb-07 3:00 
QuestionRe: Generic Signatures on remoting objects PinmemberLukeHammond15-Feb-07 3:03 
QuestionRe: Generic Signatures on remoting objects PinmemberLukeHammond15-Feb-07 3:11 
QuestionHow to create synchronous socket? PinmemberBanks K14-Feb-07 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 22 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid