Determine the Application Folder in a Custom Install Method?

J

Joe Cool

I am developing an app in C# in VS2008 that makes use of a special XML
file located in the AppData folder. I know how I can include this file
in the Application Folder with the Setup project and then the first
time the app is invoked, oopy the file to the AppData folder.

I would like to do this in a more elegant, IMHO, manner. I would like
to create the file using a custom Install Custom action. My only
problem is determining the Application Folder in the Install method of
the Installer class object. I looked at the Installer.Context property
but I did not see the Application Folder as any of tghe
Installer.Context Keys.

Any suggestions?
 
D

Dubravko Sever

Joe Cool said:
I am developing an app in C# in VS2008 that makes use of a special XML
file located in the AppData folder. I know how I can include this file
in the Application Folder with the Setup project and then the first
time the app is invoked, oopy the file to the AppData folder.

I would like to do this in a more elegant, IMHO, manner. I would like
to create the file using a custom Install Custom action. My only
problem is determining the Application Folder in the Install method of
the Installer class object. I looked at the Installer.Context property
but I did not see the Application Folder as any of tghe
Installer.Context Keys.

Any suggestions?

Hi,

In Custom Actions Commit put someting like this: CustomActionData=
/INSTALLDIR="[TARGETDIR]\", and later you can use it in method Commit like

public override void Commit(System.Collections.IDictionary savedState)
{

string AppFolder = Context.Parameters["INSTALLDIR"];
//something

}

I hope this would help you.

Dubravko
 
J

Joe Cool

I am developing an app in C# in VS2008 that makes use of a special XML
file located in the AppData folder. I know how I can include this file
in the Application Folder with the Setup project and then the first
time the app is invoked, oopy the file to the AppData folder.
I would like to do this in a more elegant, IMHO, manner. I would like
to create the file using a custom Install Custom action. My only
problem is determining the Application Folder in the Install method of
the Installer class object. I looked at the Installer.Context property
but I did not see the Application Folder as any of tghe
Installer.Context Keys.
Any suggestions?

Hi,

In Custom Actions Commit put someting like this: CustomActionData=
/INSTALLDIR="[TARGETDIR]\", and later you can use it in method Commit like

   public override void  Commit(System.Collections.IDictionary savedState)
{

            string AppFolder = Context.Parameters["INSTALLDIR"];
                //something

  }

I hope this would help you.

Thanks, works like a charm. I knew that there was some way to pass
information to custom actions but it had been so long since I had
researched it before I had forgotten how.
 

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