Hi,
The application I am building is designed to work in several configurations.
1.) The sql server 2005 database could be installed on a dedicated server and workstations containing the application connect to this instance.
2.) The sql server express database could be installed with the app on a workstation and other workstations could connect to that single database.
3.) A single user installation where the sql server express database and application are deployed to the one workstation.
The setup project I am putting together asks the user whether they wish the installer to search for an existing database.
a) If yes, the installer tries to find the database and if found, constructs the connection string and saves to a configuration file in the application directory.
b) If the user selects no, or the database isn't found, the installer runs a script on the local sql server express instance to create a new database.
However, if SQL Server Express is not installed locally, then this will need to be installed also. As the setup for SQL is no longer a merge module, I cannot apply the condition to it. I'd like the installation of SQL to be based on the condition as in b) above.
Can it be done? And if so, how?
Thanks in advance,
David. | | David Riddiford Thursday, January 26, 2006 10:01 PM | The check is run each time in the process, regardless of whether the condition is being evaluated. In other words, the schedule only applies to determining if the condition is being evaluated.
One workaround, so that your customer only sees the UI once, would be to write a regkey once the user has answered the question, and have your external check not show any UI if the regkey is set. The downside is that you'd probably want to clean up that regkey sometime, somehow.
And, you probably do need to write an unmagaged external check in order to get it to run if .NETFx is not installed. You don't need to write C code though, I think you could probably write VBScript to do it.
| | David Guyer MSFT Tuesday, February 07, 2006 6:30 PM | I tried to play with this a bit, but I haven't yet found a good answer.
The Start command seems to work, but it's not an executable, it's evaluated by the CMD.EXE processor, so you need to have one of those to run start through... kinda of a catch-22. It tried to find a command line switch you could pass to a batch file or cmd.exe that would start it up without UI, but couldn't find it.
As a result, the best workaround is to write something unmanaged... use VB6 or C++, for your External check program. | | David Guyer MSFT Friday, February 10, 2006 5:53 PM | This is not a scenario that is covered by our features today.
The only workaround I can think of off the top of my head would be to write a custom application to ask the user, and then do the search if necessary, and run the install if necessary. In other words, writing a very custom bootstrapper. | | David Guyer MSFT Thursday, January 26, 2006 10:36 PM | Hi David,
I have moved functionality like searching for existing databases to the configuration tool when the app begins.
However, I still want to give the user the option of installing SQL Server Express from ClickOnce.
What I did was :-
a) Created a console program that asks the questions and returns a 1 or 0 as an exit code.
b) Modified the package.xml file for the SQL Server Express prerequisite to run my console program and bypass if the user chooses no.
This seems to work fine.
However, I noticed that the console program runs 3 times at various points in the installation, which is a bit strange. I noticed the command sqlexpr32.exe was listed twice in the package.xml, but this doesn't explain 3 times.
I wondered if you or anyone else knew why this is happening and how to make the program only run once.
Thanks,
David Riddiford | | David Riddiford Monday, February 06, 2006 12:40 AM | Hi,
Further to my previous post, I found the Schedules element for the package.xml file.
I added this element as follows :-
<Schedules> <Schedule Name="AskQ"> <BeforePackage/> </Schedule> </Schedules>
I then applied this schedule to my ByPass condition as follows :-
<BypassIf Property="SQLExpressCondition" Compare="ValueEqualTo" Value="1" Schedule="AskQ"/>
My condition exe element in the product.xml is as follows :-
<ExternalCheck Property="SQLExpressCondition" PackageFile="SQLExpressConditional.exe"/>
This console program returns 0 as an exit code if the user answers Yes to installing SQL Express. It returns 1 otherwise.
But, despite the schedule attributes, the install tries to run SQLExpressConditional.exe at all 3 points (ie BuildList, BeforeInstall, AfterInstall).
What am I doing wrong?
Thanks,
David Riddiford | | David Riddiford Monday, February 06, 2006 3:14 AM | Actually, if the .NET Framework has not already been installed, the SQL Express Condition exe will not work anyway, because ClickOnce has to do some sort of initialisation with it before any of the prerequisites are run.
This is driving me nuts, because it seems like it should be possible.
Am I right? Do I need to create a native code SqlExpressConditional.exe and everything will be ok?
Thanks,
David. | | David Riddiford Monday, February 06, 2006 6:05 AM | The check is run each time in the process, regardless of whether the condition is being evaluated. In other words, the schedule only applies to determining if the condition is being evaluated.
One workaround, so that your customer only sees the UI once, would be to write a regkey once the user has answered the question, and have your external check not show any UI if the regkey is set. The downside is that you'd probably want to clean up that regkey sometime, somehow.
And, you probably do need to write an unmagaged external check in order to get it to run if .NETFx is not installed. You don't need to write C code though, I think you could probably write VBScript to do it.
| | David Guyer MSFT Tuesday, February 07, 2006 6:30 PM | Hi David,
This seemed to work ok.
It didn't seem to want to run a vbs file by itself. So I created a batch to run the vbs and that worked. Having the command window appear, and then a vbs message box on top of that looks a bit ugly. Any ideas?
I check for a reg key in the script and ask the question if not found. After the question is answered I write the reg key. My installed application goes through a configuration process when it is 1st run. So I can delete the registry key at this point hopefully.
Any ideas about the command window displaying (3 times, but only asked question 1st time) would be much appreciated.
Thanks,
David. | | David Riddiford Wednesday, February 08, 2006 6:15 AM | I tried to play with this a bit, but I haven't yet found a good answer.
The Start command seems to work, but it's not an executable, it's evaluated by the CMD.EXE processor, so you need to have one of those to run start through... kinda of a catch-22. It tried to find a command line switch you could pass to a batch file or cmd.exe that would start it up without UI, but couldn't find it.
As a result, the best workaround is to write something unmanaged... use VB6 or C++, for your External check program. | | David Guyer MSFT Friday, February 10, 2006 5:53 PM | Thats cool. Thanks for your help with this David.
Cheers,
David. | | David Riddiford Saturday, February 11, 2006 4:02 AM |
|