views:

686

answers:

1

I created a new Visual Studio Setup project with VS 2008.

I use it to install SQLExpress. The installatino of SQLExpress works fine when I do it manually outside of the installer.

But when I install, I get an error in SQL Express with permissions. I found out that it's because the SQLExpress process is running as the System account when I run it from my setup project.

I tried starting the process both via custom actions and via C# code that runs after a module is installed via Process.Start. But both of them run the SQLExpress process as the System account.

What can I do to run this process instead as the currently logged on user?

Note: I also tried to start calc.exe and that runs as the system process as well. Why won't it run under the context of the same user as my installer is running as?

+3  A: 

If you want to install SQL Server Express as a prerequisite to your application you should add it as a prerequisite to you Setup and Deployment project.

This can be done by right-clicking on your setup project, then choosing Properties -> Prerequisites and then checking SQL Server Express 2008.

Note that in order to have SQL Server Express available in the list of prerequisites it must be installed on your development machine.

Update:

If you want to specify an instance name there is no way around manually editing the bootstrapper package definition.

For Visual Studio 2008 the bootstrapper packages are placed in the following location by default:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages

There you will also find a folder names SqlExpress. Within that folder, open the file en\package.xml and modify the command line arguments for the installer. There are three sections depending on the target OS (Win 2000, XP and 2003+):

<Command PackageFile="sqlexpr32.exe" 
         Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all 
                    instancename=SQLEXPRESS SQLAUTOSTART=1 ADDUSERASADMIN=1" 
                    EstimatedInstalledBytes="225000000" 
                    EstimatedTempBytes="225000000" 
                    EstimatedInstallSeconds="420">

   ...

</Command>

This change will affect all installers with this package as a prerequisite that are build on your system. If you don't want that you would have to create your own separate bootstrapper package by copying the SqlExpress folder and updating the ProductCode in SqlExpress\package.xml.

0xA3
How do you specify an instance name in that case? Before I did this via the command lines that sql express gives you. /INSTANCENAME=MyInstance I want to deploy a new instance.
Net Citizen
Thanks for your help!
Net Citizen