|
Prev: Mouse clicks don't always fire button event?
Next: Any one know how to make users pay for your software
From: dddd on 15 Jul 2008 08:57 "Shawn" wrote: > I need to get the path to my program after it has been installed. In other > words, I want to be able to run a separate application that gets the path to > the other apps app.config file. This needs to work no matter where the user > installed the first app to and I would prefer to avoid looking at the > registry. > > Thanks, > Shawn > > >
From: dddd on 15 Jul 2008 08:58 "Shawn" wrote: > I need to get the path to my program after it has been installed. In other > words, I want to be able to run a separate application that gets the path to > the other apps app.config file. This needs to work no matter where the user > installed the first app to and I would prefer to avoid looking at the > registry. > > Thanks, > Shawn > > >
From: dddd on 15 Jul 2008 08:59 "Shawn" wrote: > I need to get the path to my program after it has been installed. In other > words, I want to be able to run a separate application that gets the path to > the other apps app.config file. This needs to work no matter where the user > installed the first app to and I would prefer to avoid looking at the > registry. > > Thanks, > Shawn > > >
From: Phill W. on 17 Jul 2008 07:35
dddd wrote: > I need to get the path to my program after it has been installed. There are other ways but I tend to use: System.Reflection.Assembly.GetEntryAssembly().Location > In other words, I want to be able to run a separate application > that gets the path to the other apps app.config file. Now /that's/ not so simple. You're going to have to persist the installed location somewhere outside of both programs. The Registry is quick and easy and there /is/ plenty of precedent for using it (see below). However, even if you can /get/ to that file, what are you hoping to /do/ with it? You may hit problems trying to access or update the file. > This needs to work no matter where the user installed the first app > to and I would prefer to avoid looking at the registry. You might prefer to avoid it (I'm getting there myself, to be honest) but this is actually one of the Good Reasons for using the Registry; it's where applications have "published" their installed locations for years. Have a look under ... HKLM\Software\Microsoft\WindowsCurrentVersion\App Paths .... and you'll find just about everything that you can start by Start > Run ... Not such a bad place to add your own entry, perhaps? If you /really/ don't want to use the Registry, then you're probably looking at writing a file somewhere under the "All Users/Application Data" sub-tree in the file system. However, if you were avoiding the Registry for security reasons, then you'll probably face the /same/ problems trying to update these directories as well - "regular" [Vista] Users won't be able to update this area so you'll have to create an "installer" for your programs. HTH, Phill W. |