jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Accessing Temporary Files

The user has the option to install SQL Express 2008 R2 (included in install) prior to installing the application. I would like to perform a silent install so I am using a Configuration.ini file to allow the SQL Express install to run unattended. This .ini file is not needed after the install process so I've imported it as a temporary file. I will, however, need to edit the file based on some information the user inputs (SQL Server Instance ID, user login, password).

1. I'm assuming you edit the parameters you want by adding the [PROPERTY_NAME] just like in xml, right?
2. Once the .ini file is edited, how do I access it? I'm kicking off the SQL Express installation using a cmd line string where I have to put in a switch \ConfigurationFile="<path and filename>" so I will either need the relative path or just copy the file to c:\.

Thanks!
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Accessing Temporary Files

Hello,

Temporary files reside in the TempFolder:
http://www.advancedinstaller.com/user-g ... paths.html

For more information about temporary files you can read this user guide article:
http://www.advancedinstaller.com/user-g ... files.html
I'm assuming you edit the parameters you want by adding the [PROPERTY_NAME] just like in xml, right?
Indeed, as mentioned in the last paragraph from this article.

You can include your .INI file as a temporary file and add a .INI file update for it with the same name in the TempFolder on the Files and Folders page. After doing this, you can reference the file path using the following formatted reference:

Code: Select all

[&<your_INI_file_name>]
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

Thank you for the format to get to the temporary file. That fixed that problem.

The user has the option to do an Express Install which installs the database silently using the ConfigurationFile.ini. There is also an option to do a Custom / Advanced installation. I was going to install the database using the unattended install but have decided to let the user run through the whole install and enter their own information. It makes my job easier because then I don't have to get all the unique information transferred from the UI to the .ini file. In the Prerequisites->Feature-based->SQL Server 2008 R2 Express->Setup Files tab I have the Full UI field filled in with the command line to run the install silently using the configuration file.

Is there a way to make this conditional so that when the user selects the Express Installation it uses the silent install but when they select Custom / Advanced Installation the user just goes through the SQL Install UI and enters their information in there?

Thanks!
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

I just had a thought... Would the way to do this be to kickoff a custom action that runs a .bat file (or something from a command line) that just starts the SQL Express setup.exe?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Accessing Temporary Files

Hi,
Thank you for the format to get to the temporary file. That fixed that problem.
If you don't need to edit the .INI file anymore, you can also look into the "Additional Files" functionality:
http://www.advancedinstaller.com/user-g ... files.html
This functionality is available when adding a "File from disk" prerequisite.

Here's what you can try:
- add the same "SQL Server 2008 R2 Express" twice as feature-based prerequisites
- use the following article to create a feature selection dialog:
http://www.advancedinstaller.com/user-g ... ature.html

I trust you can figure out how to edit and configure the project using the above basic ideas.

Let us know if you get any blockers.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

Thank you for your prompt responses! So here is where i am now:

I have the the Express version of the install that installs everything without any user interaction. It uses the ConfigurationFile.ini file to install SQL Express 2008 R2 in silent mode. I added the ConfigurationFile.ini to the Temporary Folder TWICE - Once as an imported .ini file and once as a normal windows installer file. There are a few properties in the .ini file that are tied to properties in the installer (SERVERNAME_PROP, USERNAME_PROP, and SAPWD_PROP). I can modify these using a custom action that sets the property. However, when I call the command to install SQL Express 2008 R2 using a silent install:

SQLEXPR_x86_ENU.exe /ConfigurationFile="[TempFolder]ConfigurationFile.ini"

The file it uses doesn't seem to contain the changes I made to it (remember I added the .ini file twice in the temp folder). Is there something I'm missing?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Accessing Temporary Files

Hello,
However, when I call the command to install SQL Express 2008 R2 using a silent install:
If you are using a custom action to achieve this you can try to schedule it after "WriteEnvironmentStrings" standard action.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

No - I am not using a custom action. I have added SQL Express 2008 R2 as a prerequisite and I filled in the Install Command Lines / Full UI command with:

SQLEXPR_x86_ENU.exe /ConfigurationFile="[TempFolder]ConfigurationFile.ini"

At what point during the installation are those changes actually made to the file? After WriteEnvironmentStrings? Does this occur prior to installing the prerequisites. If not, I may be able to just write some .bat files to handle the SQL installation.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Accessing Temporary Files

Hello,
At what point during the installation are those changes actually made to the file? After WriteEnvironmentStrings?
Actually after WriteINIValues, WriteEnvironmentStrings comes right after that.
Does this occur prior to installing the prerequisites. If not, I may be able to just write some .bat files to handle the SQL installation.
A quick solution you can try instead is to set your prerequisite as post-install. Post-install prerequisites are also feature based.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

I circumvented this problem by including some of the configuration items as parameters in the SQL Express install string. These - computer name, user name - were easily added via Windows ENVIRONMENT VARIABLES inline.
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Accessing Temporary Files

Follow up Question:

If I choose to add the ConfigurationFile.ini to the "Additional Files" section of the prerequisites, what physical location is it put in and how do I access it? I need to use it as part of the command line arguments to start the silent install:

EXAMPLE:
SQLEXPR_x86_ENU.exe /ConfigurationFile="[FOLDER]ConfigurationFile.ini"

What should [FOLDER] be?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Accessing Temporary Files

Hi,

For feature-based prerequisites you can add the INI as a temporary file.

You can then use the temporary file property in the prerequisite command line. For example, if the temporary is using a property called SQL_INI_TEMP_FILE, the prerequisite command line can look something like this:

Code: Select all

/ConfigurationFile=[SQL_INI_TEMP_FILE]
Pre-install prerequisites are handled by the EXE bootstrapper, so they cannot access temporary files stored in the MSI. Instead, you can try adding the configuration file as a prerequisite additional file:
- in the prerequisite Setup tab add the configuration file as an additional file
- select Packages root in Prerequisites view
- in Global Prerequisite Options section set a specific prerequisite extraction folder, for example:

Code: Select all

[AppDataFolder]My Prerequisites
- all additional files are extracted next to their prerequisites, so your prerequisite command line can now use the extraction folder, for example:

Code: Select all

/ConfigurationFile=[AppDataFolder]My Prerequisites\ConfigurationFile.ini
Please note that you can also specify a folder in the prerequisite Setup tab. This way you can separate the additional files for each prerequisite.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”