My problem
Next: import a Visual Studio 2010 solution into my new (and still shiny) Visual Studio 2012. It was a standard winforms app. One tiny (easily solvable) problem occurred: The solution contained a SQL CE database, version 3.5. On my shiny new Win8 system SQL CE 4.0 was installed, either by windows itself, visual studio or SQL server 2012? (Who knows, who cares?) So I updated the references in my project to the new SQL CE objects and sure enough it compiled and ran smoothly.
Visual Studio 2012 doesn't support the 2010 Visual Studio Installer projects. This forced me to create a new Setup and Deployment project in Flexera's Installshield 2012 Spring Limited Edition. And here problems started to rise...
Prerequisite troubles...
To start with: The "Light Edition" is severely crippled (imho). It's really the absolute minimum which enables you to create a setup file, but there's very little room to tailor it. I guess they (flexera) think by doing so we're forced to buy the full version?!?!
Back to the problem: You can add prerequisites to the installer, this is the good news. The bad news however: there is no SQL CE 4.0 prerequisite to be found anywhere!!!!
Now what?
Problem solved
To shorten the story (I assume you're not interested in my frustration leading to the solution) I've figured out how to create a custom prerequisite to install SQL CE 4.0 with my application installer.
Install Shield 2012 LE - Prerequisites... |
Step 1
Download the SQL Server Compact redistributables from the Microsoft Download Center at http://www.microsoft.com/en-us/download/details.aspx?id=30709.- SSCERuntime_x86-ENU.exe
- SSCERuntime_x64-ENU.exe
Step 2
Create the prerequisite files for Installshield. First of all a big thank you for posting the most important part of the solution on Stack Overflow by Enzero This helped me big time.With version 3.5 of CE there was a single installer for both x86 and x64. With 4.0 there are two separate installers. This is where I needed to tweak Enzero's solution. A check if my app is installed on a 32 or 64 bit OS.
So the "tinkered" scripts are now:
Microsoft SQL CE 4.0 SP1 (x86).prq
<?xml version="1.0" encoding="utf-8"?>
<SetupPrereq>
<conditions>
<condition Type="4" Comparison="2" Path="[ProgramFilesFolder]\Microsoft SQL Server Compact Edition\v4.0" FileName="sqlceca40.dll" ReturnValue="" Bits="2"/>
</conditions>
<operatingsystemconditions>
<operatingsystemcondition Bits="1"></operatingsystemcondition>
</operatingsystemconditions>
<files>
<file LocalFile="<ISProductFolder>\SetupPrerequisites\SQL CE 4.0 SP1\SSCERuntime_x86-ENU.exe" URL="http://download.microsoft.com/download/F/F/D/FFDF76E3-9E55-41DA-A750-1798B971936C/ENU/SSCERuntime_x86-ENU.exe" FileSize="0,0" />
</files>
<execute file="SSCERuntime_x86-ENU.exe" cmdline="/i /passive" cmdlinesilent="/i /passive" />
<properties Id="{05DCCDB5-57E0-4314-A016-874F228A8FAD}" Description="This prerequisite installs the Microsoft SQL Server Compact 4.0 SP1. (x86 32bit edition)"/>
</SetupPrereq>
Microsoft SQL CE 4.0 SP1 (x64).prq
<?xml version="1.0" encoding="utf-8"?>
<SetupPrereq>
<conditions>
<condition Type="4" Comparison="2" Path="[ProgramFilesFolder]\Microsoft SQL Server Compact Edition\v4.0" FileName="sqlceca40.dll" ReturnValue="" Bits="2"/>
</conditions>
<operatingsystemconditions>
<operatingsystemcondition Bits="4"></operatingsystemcondition>
</operatingsystemconditions>
<files>
<file LocalFile="<ISProductFolder>\SetupPrerequisites\SQL CE 4.0 SP1\SSCERuntime_x64-ENU.exe" URL="http://download.microsoft.com/download/F/F/D/FFDF76E3-9E55-41DA-A750-1798B971936C/ENU/SSCERuntime_x64-ENU.exe" FileSize="0,0"/>
</files>
<execute file="SSCERuntime_x64-ENU.exe" cmdline="/i /passive" cmdlinesilent="/i /passive" />
<properties Id="{05DCCDB5-57E0-4314-A016-874F228A8FAD}" Description="This prerequisite installs the Microsoft SQL Server Compact 4.0 SP1. (x64 64bit edition)"/>
</SetupPrereq>
Step 3
To make this voodoo all come to life we need one last step. When Installshield Spring LE was default installed the prerequisite folder should be located here:C:\Program Files (x86)\InstallShield\2012SpringLE\SetupPrerequisites
At this location create 2 ".prq" files (with any text editor -notepad will do-):
- Microsoft SQL CE 4.0 SP1 (x86).prq
- Microsoft SQL CE 4.0 SP1 (x64).prq
In this folder you also need to create a new subfolder: SQL CE 4.0 SP1
In this "SQL CE 4.0 SP1"-folder you mustcopy the two downloaded redistributable files from Microsoft: SSCERuntime_x86-ENU.exe & SSCERuntime_x64-ENU.exe
Watch carefully when adding the folder with redistributable files. The naming is used in both .prq XML content.
That's it!
Now, when you look at the redistributables in your Visual Studio setup project, you should see the x86 and x64 SQL CE 4.0 prerequisites. If you're not sure if your app is going to be installed on a x86 Windows OS or an x64. just add both! The "<operatingsystemconditions>" part in the XML checks if the prerequisite should be installed based on the architecture.
Keep in mind...
Though this "trick" does work and does install SQL CE 4.0 with your applications setup, beware this is not an official prerequisite! I don't think it's illegal either ("freely redistributable under a redistribution license agreement")
Other then this, you're good.
It took me a few free evenings to figure this one out. I hope you find this info useful and it didn't took you that long for you to find my blog entry :o)