How to set the default installation folder in a setup project?
-
Thursday, March 04, 2010 3:31 PMHI
I've created a windows application using VS 2005 (c#). I also have a setup project. My query is how I can specify which folder to install the app in? And yes I know there are system folder keys like [Program Files Folder] etc etc. But I need it to install in a completely different folder under my C:\(eg: C:\ABC\DEF\GHI\ApplicationFolder), which currently doesn't have a key. Do I need to create a registry key for the folder and if so how do I go about doing that? Or is there a simpler solution to this? This folder exists in all my client machines, so hardcoding wouldn't be an issue.
Please do help me, I've been trying to find a solution for a long time now.
Thanks in advance,
PBCL
All Replies
-
Monday, March 08, 2010 3:43 AMModeratorHi Country_Lass,We can use the Orca tool to alternate the default value of the TARGETDIR property which refers to the installation directory. Below are the detail steps to change the default installation directory to 'C:\test':1. Open the msi via Orca tool.2. Open the Directory table, set the DefaultDir column of TARGETDIR to 'C:\test'.3. Open the CustomAction table, set the Target column of DIRCA_TARGETDIR to 'C:\test'.You can get more about orca tool from:
http://msdn.microsoft.com/en-us/library/aa370557(VS.85).aspxLet me know if this does not help.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. -
Tuesday, March 09, 2010 3:03 PMHi Aland
Thank you for your help. I did download the ORCA tool as you suggested and was able to edit the TARGETDIR and the DIRCA_TARGETDIR of the resulting msi file. But when I try to install it, I get the error code - 2704. Any clue as to why this might be happening?
Regards
Country_Lass -
Wednesday, March 10, 2010 5:09 AMModeratorHi Country_Lass,
Did you close the ORCA tool after saving the edited msi. It will throw exceptions when your open the msi file via orca and install it at the same time.
Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. -
Wednesday, March 10, 2010 5:13 AM
You can change the default install location for the file folder in the File System view of your setup project. In the properties it's the "DefaultLocation" property.
The 2704 error occurs mostly when DefaultDir was set wrong in the Directory table of a MSI file. Try leaving the TARGETDIR's DefaultDir to 'SourceDir' and only have the DIRCA_TARGETDIR set the targetdir.
Sebastian Brand http://blog.sebastianbrand.com- Marked As Answer by Country_Lass Wednesday, March 10, 2010 3:22 PM


