473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to get the location where user ask msi to install the application

Hi,

I want to get the location which user selects for installaion of
program using msi installer. I require this to do kind of cleanup
activity if something goes wrong with the installation.

Regards,
Vidisha
Jun 27 '08 #1
12 1734
That is [TARGETDIR].

"vi***********@gmail.com" wrote:
Hi,

I want to get the location which user selects for installaion of
program using msi installer. I require this to do kind of cleanup
activity if something goes wrong with the installation.

Regards,
Vidisha
Jun 27 '08 #2
Yes I tries that thanks for answering However I want both /
SrcDir="[SourceDir]\" and /TrgDir="[TARGETDIR]\"

however when I give /SrcDir="[SourceDir]\" , /TrgDir="[TARGETDIR]\"
for my custom action it does not work. How can I get both.
Jun 27 '08 #3
/SrcDir="[SourceDir]\" /TrgDir="[TARGETDIR]\"

"vi***********@gmail.com" wrote:
Yes I tries that thanks for answering However I want both /
SrcDir="[SourceDir]\" and /TrgDir="[TARGETDIR]\"

however when I give /SrcDir="[SourceDir]\" , /TrgDir="[TARGETDIR]\"
for my custom action it does not work. How can I get both.
Jun 27 '08 #4
Thanks that actually worked.

To confirm I want to ask I have to check some conditions from
SourceDir and if it fails then I have to rollback the installation.
However it looks like I have to write a program to delete the files
from TARGETDIR as it does not get deleted automatically.

Please confirm.
Jun 27 '08 #5
It sounds like, based on some condition within the source installation, you
want to uninstall after begining the install, via a custom action. To be
honest, I have never had need to do this intentionally. I have had occasion
where this occurs via an error being thrown in my custom action. Therefor, I
would recommend throwing an exception from your custom action code, such as
New Exception("You have a stolen source disk"). This install should then
"fail" more or less gracefully.

"vi***********@gmail.com" wrote:
Thanks that actually worked.

To confirm I want to ask I have to check some conditions from
SourceDir and if it fails then I have to rollback the installation.
However it looks like I have to write a program to delete the files
from TARGETDIR as it does not get deleted automatically.

Please confirm.
Jun 27 '08 #6
Yes I do that
InstallException("Installer failed");

however files from the target directory do not get removed. So I have
to remove it by my program.

Do you recommed this.
Jun 27 '08 #7
Strange... My experience is the files got removed. I guess you will need to
do it manually in your code.

"vi***********@gmail.com" wrote:
Yes I do that
InstallException("Installer failed");

however files from the target directory do not get removed. So I have
to remove it by my program.

Do you recommed this.
Jun 27 '08 #8
some of the files are used in the targetdir and therefore it is
throwing an exception and not leting me delete the files :(
Jun 27 '08 #9
Can you move your checks from the SourceDir to occur in the OnBeforeInstall
event? This is presuming you are doing it in the Commit event now.

"vi***********@gmail.com" wrote:
some of the files are used in the targetdir and therefore it is
throwing an exception and not leting me delete the files :(
Jun 27 '08 #10
Hi I am checking it in OnBeforeInstall, however all the files do not
get deleted
if (!File.Exists(filepath))
{
if (Directory.Exists(targetPath))
{
string[] files =
Directory.GetFiles(targetPath);
foreach (string str in files)
{
try
{
File.Delete(str);
}
catch
{ }
}
try
{
Directory.Delete(targetPath);
}
catch { }
}

throw new InstallException("Installer downloaded
is corrupted. Please download again");

}

If I just throw the InstallException without programatically deleteing
files then cleaup is not proper. therefore I have to delete the files
for proper cleanup. still some file remain in targetdirectry as they
are used by some process

Can you point it what wrong I am doing.
Jun 27 '08 #11
I'm sorry, but I am at a loss as to why files would be in the target from
your install when checked in the OnBeforeInstall custom action.

"vi***********@gmail.com" wrote:
Hi I am checking it in OnBeforeInstall, however all the files do not
get deleted
if (!File.Exists(filepath))
{
if (Directory.Exists(targetPath))
{
string[] files =
Directory.GetFiles(targetPath);
foreach (string str in files)
{
try
{
File.Delete(str);
}
catch
{ }
}
try
{
Directory.Delete(targetPath);
}
catch { }
}

throw new InstallException("Installer downloaded
is corrupted. Please download again");

}

If I just throw the InstallException without programatically deleteing
files then cleaup is not proper. therefore I have to delete the files
for proper cleanup. still some file remain in targetdirectry as they
are used by some process

Can you point it what wrong I am doing.
Jun 27 '08 #12
they are temp files created at the process of installation. As even in
before install all the files in msi are downloaded to the location
where we want to install the program.

Correct me if I am wrong.
Jun 27 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ARobi | last post by:
I have developped an Access database with a lot of coding. The size of the database without data is about 5 meg. I am ready to copy the database to a client PC which already has a legal version...
2
by: Bill | last post by:
I have an Access 2003 database application that I split into an application component MDB file (i.e., forms, etc) and a data component MDB file (i.e., tables, etc.). I used the 2003 developer...
14
by: Keith | last post by:
I have an MDE application used by several hundred people in different parts of the world. The majority of users are of lesser experience computer experience. The app consists of a frontend (MDE)...
4
by: JDS | last post by:
I am using a setup project and Windows Installer to deploy my application and have some additional code in custom actions. In this code I need to refer to one of the install files but I cannot find...
0
by: coopdog | last post by:
This is a new issue as of an install to sp1 on vb express 2005. When I publish the application to my drive then I try to install it is wants to be installed from the same location as it was...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.