Install Project Custom Action Failure

E

Eric

Using VS.Net 2003 .Net framework 1.1 SP1

Our installation project calls a Custom Action dll to perform post install
actions. It fails if the .msi file is launch from a directory that contains
spaces, such as:

My Install Folder\SetupDir

The exception thrown is:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: File or assembly name and, or one of its
dependencies, was not found

In the custom action project, I've overridden both Install and Commit. The
commit section is the method that does the actual work. We placed message
boxes at the top
of each function to attempt to see where the failure occurred. We see the
"Reached Install" message but not the Commit. By attaching to the process
I've also confirmed that the call to base.Install(stateSaver) is called and
does not throw the exception. So somewhere after base.Install(stateSave)
and the entry into Commit the error mentioned above is thrown. If the .msi
is launched from MyInstallFolder\SetupDir all is fine. Not sure where to go
with this at this point. Help would be appreciated.

public override void Install(IDictionary stateSaver)
{
MessageBox.Show("Reached Install");
base.Install (stateSaver);
}

public override void Commit(IDictionary savedState)
{
MessageBox.Show("Reached Commit");
base.Commit (stateSaver);
rest of code....
}
 
E

Eric

Some additional info that appears to be causing the problem. In the
installation project, if you right-click on the project name select
View->Custom Actions then view the properties for the Primary output in the
Commit Folder I've specified /InstPath=[OriginalDatabase] in the
CustomActionData property. If I remove it all is well. The problem is I
need to know the folder that the .msi launched from and don't know another
way to get it.
 
P

Phil Wilson

You might need to quote the OriginalDatabasePath as it describes here for
TARGETDIR:
http://msdn2.microsoft.com/en-us/library/2w2fhwzz.aspx

You get the FileNotFoundException because there is a bunch of code parsing
your CustomActionData string which is concatenated with some internal
iimplementation string data, such as the name of the assembly containing the
installer class. It's tripping over the parsing of your string and winding
up with a nonsense name for the assembly (and probably the associated state
file).
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

Eric said:
Some additional info that appears to be causing the problem. In the
installation project, if you right-click on the project name select
View->Custom Actions then view the properties for the Primary output in
the Commit Folder I've specified /InstPath=[OriginalDatabase] in the
CustomActionData property. If I remove it all is well. The problem is I
need to know the folder that the .msi launched from and don't know another
way to get it.

Eric said:
Using VS.Net 2003 .Net framework 1.1 SP1

Our installation project calls a Custom Action dll to perform post
install actions. It fails if the .msi file is launch from a directory
that contains spaces, such as:

My Install Folder\SetupDir

The exception thrown is:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: File or assembly name and, or one of
its dependencies, was not found

In the custom action project, I've overridden both Install and Commit.
The commit section is the method that does the actual work. We placed
message boxes at the top
of each function to attempt to see where the failure occurred. We see
the "Reached Install" message but not the Commit. By attaching to the
process I've also confirmed that the call to base.Install(stateSaver) is
called and does not throw the exception. So somewhere after
base.Install(stateSave) and the entry into Commit the error mentioned
above is thrown. If the .msi is launched from MyInstallFolder\SetupDir
all is fine. Not sure where to go with this at this point. Help would
be appreciated.

public override void Install(IDictionary stateSaver)
{
MessageBox.Show("Reached Install");
base.Install (stateSaver);
}

public override void Commit(IDictionary savedState)
{
MessageBox.Show("Reached Commit");
base.Commit (stateSaver);
rest of code....
}
 
E

Eric

Many thanks. That did it. I tried quoting the value several different
ways but was unaware of the need for the ending backslash.


Phil Wilson said:
You might need to quote the OriginalDatabasePath as it describes here for
TARGETDIR:
http://msdn2.microsoft.com/en-us/library/2w2fhwzz.aspx

You get the FileNotFoundException because there is a bunch of code parsing
your CustomActionData string which is concatenated with some internal
iimplementation string data, such as the name of the assembly containing
the installer class. It's tripping over the parsing of your string and
winding up with a nonsense name for the assembly (and probably the
associated state file).
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

Eric said:
Some additional info that appears to be causing the problem. In the
installation project, if you right-click on the project name select
View->Custom Actions then view the properties for the Primary output in
the Commit Folder I've specified /InstPath=[OriginalDatabase] in the
CustomActionData property. If I remove it all is well. The problem is I
need to know the folder that the .msi launched from and don't know
another way to get it.

Eric said:
Using VS.Net 2003 .Net framework 1.1 SP1

Our installation project calls a Custom Action dll to perform post
install actions. It fails if the .msi file is launch from a directory
that contains spaces, such as:

My Install Folder\SetupDir

The exception thrown is:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: File or assembly name and, or one of
its dependencies, was not found

In the custom action project, I've overridden both Install and Commit.
The commit section is the method that does the actual work. We placed
message boxes at the top
of each function to attempt to see where the failure occurred. We see
the "Reached Install" message but not the Commit. By attaching to the
process I've also confirmed that the call to base.Install(stateSaver) is
called and does not throw the exception. So somewhere after
base.Install(stateSave) and the entry into Commit the error mentioned
above is thrown. If the .msi is launched from MyInstallFolder\SetupDir
all is fine. Not sure where to go with this at this point. Help would
be appreciated.

public override void Install(IDictionary stateSaver)
{
MessageBox.Show("Reached Install");
base.Install (stateSaver);
}

public override void Commit(IDictionary savedState)
{
MessageBox.Show("Reached Commit");
base.Commit (stateSaver);
rest of code....
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top