views:

1176

answers:

3

I want to get the installed path of a C# project setup. In C#.net. How can I use this path in Installer Class for checking that the setup is installed or not?

Actually I want to check if the setup is installed in the system or not . If it is, I want to repair this.

A: 

I don't understand exactly what you want but you could simply check whether a directory exists by using Directory.Exists method

Environment.SystemDirectory gets the system directory on the machine.
Mez
He wants to know where his program is installed. Directory exists is only handy if you know what folder.
PoweRoy
+1  A: 

Create a register entry with the installer. hkey_local_machine/software/ and a var installdir with value the path.

When you have an update version of your program, check in the installer class for that key. If it exists update, else new install.

PoweRoy
+1  A: 

You can get the path of the folder that you are installing to from

Context.Parameters["targetdir"]

So you can check that is empty before installing. Obviously that won't tell you if there are other versions installed elsewhere.

Martynnw