
Update of existing .NET App - How to find the application path?
Unfortunately, you are correct in your choices. While having apps that can be
installed via xcopy is great, the trade off is, of course, that other apps have
no way of determining where anything is installed.
The best choice is to have your app write a key to the registry. This is pretty
standard practice and the good thing is that the app itself doesn't need to rely
on the registry keys, only the upgrade app. However, if for some reason the reg
key is missing your fallback option should be to give the user a choice of
whether they want to select the directory the app is installed in or having the
install proggy search the HD.
Your suggested option C is no different than writing a key to the registry and
an ini file is more likely to be deleted.
Hope this helps!
Michael G. Emmons
On Fri, 21 Dec 2001 14:43:21 +0100, "Urs Eichmann"
Quote:
>Let's assume there is a customer which has installed a .NET application in a
>certain application path i.e. "C:\Program Files\MyNetApp". Now he wants to
>install an update from the internet and downloads an SETUP.EXE from our
>internet site. Now the update installation program has to find the path
>where the application was installed. What is the best practice to find this
>path in a .NET environment?
>Here are some ideas, but none of them I really like much:
>a) On first install, write the install path somewhere in the registry.
>Read the path from the registry on update. - This can't be the right way
>since .NET app should avoid the registry altogether (which I generally find
>a good idea)
>b) Search for the app executable on all local drives - no good idea
>because of possible name clashes and old versions of the executable in
>temporary folders that may be lying around
>c) Keep a small .INI or .XML file in C:\WINNT\System32 or so where the
>actual application setup path is being stored - can't be good either, since
>I don't want my apps to put anything into the C:\WINNT folder (for security
>and permission reasons).
>So what is the "official" way?
>Thanks for any suggestions!
>Urs Eichmann
>PRISMA Informatik AG
>Dietlikon, Switzerland
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.
Michael G. Emmons
Independent Consultant &
Software Architect