SQL Server CE 4 Clickonce deploy VS2013 - visual-studio-2013

According to MS, SQL Server CE is being deprecated, but for now, I really can't think about migrating to SQL Server Express or LocalDB, so, on VS 2013, there is a exclamation with a text "Prerequisite could not be found for bootstrapping". Is there a way to workaround? When my program is deployed, SQL Server CE need to be installed automatically.
Thanks in advance

I had got the same problem. SQL Server Compact Edition 4.0 was not existed in my VS 2013 Prerequisite list in publish section of my project. To solve the same problem I've used next steps:
Download install files for Microsoft® SQL Server® Compact 4.0 SP1
Go to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages
Create SQL Server Compact Edition 4.0 folder in current location
Copy downloaded install files to created folder
Create product.xml file in created folder and copy next code in this file
product.xml:
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="System.Data.SqlServerCe.4.0">
<InstallChecks>
<FileCheck Property="IsInstalled"
FileName="System.Data.SqlServerCe.dll" SearchPath="C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Desktop" />
</InstallChecks>
<PackageFiles CopyAllPackageFiles="false">
<PackageFile
Name="SSCERuntime_x86-ENU.exe"
HomeSite="sqllocaldb_32" />
<PackageFile
Name="SSCERuntime_x64-ENU.exe"
HomeSite="sqllocaldb_64" />
</PackageFiles>
<Commands Reboot="Defer">
<Command PackageFile="SSCERuntime_x86-ENU.exe" Arguments="">
<InstallConditions>
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
<BypassIf Property="IsInstalled" Compare="ValueExists" Value="0" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="1641" Result="SuccessReboot" />
<ExitCode Value="3010" Result="SuccessReboot" />
<DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
<Command PackageFile="SSCERuntime_x64-ENU.exe" Arguments="" >
<InstallConditions>
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
<BypassIf Property="IsInstalled" Compare="ValueExists" Value="0" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="1641" Result="SuccessReboot" />
<ExitCode Value="3010" Result="SuccessReboot" />
<DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
Create en folder in created folder
In en folder create package.xml file and copy next code in this file:
package.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture">
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">SQL Server Compact Edition 4.0</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install SQL Server Compact Edition 4.0. Contact your administrator.</String>
<String Name="GeneralFailure">A failure occurred attempting to install SQL Server Compact Edition 4.0.</String>
</Strings>
</Package>
Restart MS Visual Studio
And you can find SQL Server Compact Edition 4.0 in Prerequisite

If for one reason or another you can't (directly) apply the fix of Erik, then you can try the following workaround:
Get a hold on the SQL Server Compact Edition 4.0 bootstrap package, you might find it somewhere on your disk or you could get it from a colleague
Install that package in the C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages folder, as this folder is used by VS2013 to look for bootstrap packages
Restart VS and the prerequisite warning should be gone

You can simply include the SQLCE dll files with your app, I have several blog posts on how to do this

Related

ClickOnce Prerequisites: where is SQL Server Express 2014 LocalDB?

I am creating a clickonce installer for my wpf application from within Visual Studio 2013 Community edition. This application uses a localdb. It works fine on the target machines if I manually install sqlserver express 2014 LocalDB.
But I would like to include the installer for SQL Server Express 2014 LocalDB with my clickonce deployment.
When I open the prerequisites dialog, however, only SQL Server 2012 Express LocalDB is available (see image). I tried selecting '2012, but it is not compatible with the mdf file my installer drops into the data folder.
The question is: How do I include the SQL Server Express 2014 LocalDB installer as a prerequisite? Is there a way to just drop the MSI file somewhere and make it work? Or will it be easier to stick with '2012?
As I posted on the MSDN forums I created my own package as an official version doesn't exist. The package is basically just a copy of the SqlLocalDB2012 package updated to point to the new version of msi files to download.
I've put all the files for the boostrapper package on GitHub so people don't have to create the files themselves. There's two versions, one for the original release and one for the SP1 release. Following are the steps to create the original release version yourself:
Create a folder SqlLocalDB2014
Create an xml file in the folder called product.xml with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.SqlServer.SqlLocalDB.12.0">
<InstallChecks>
<FileCheck
Property="sqllocaldbVersion"
FileName="sqlservr.exe"
SearchPath="Microsoft SQL Server\120\LocalDB\Binn"
SpecialFolder="ProgramFilesFolder"
/>
</InstallChecks>
<PackageFiles CopyAllPackageFiles="false">
<PackageFile
Name="x86\sqllocaldb.msi"
HomeSite="sqllocaldb_32"
PublicKey="3082010A0282010100E57C2F2D0CA9EC7AA834E04C3F7F490E0DB615AD1913DE528A26991571A962270737A5833082626C0BA3FD060D171406E6E0ADCC95960A205AA296E1E057303C5D629BC55D890CD034DFD9D8FA35EF11238BC0F9EB4AF439DA2F7110EB11B32C37A370E886173EEF2A46D08EC7B94800A137F1C7C8E7D21E6B4A2AF2C64C1D709F7CC368428E3CED811A52E33E32943D7E18F19BE44B5C11E4D6C3851E6C033073BCC9A8017D9DADD1F573F05B1A7B2F1F8B32BEB38EB53BD9F7FFF35FB3137C139357B8A05E359883A13434F2C5049FB9FE46170C91DFEF0F55F6ECCC39C96165A129EEBE11371BB76E4255C9CC35D152B303709C98349E2936A917195F0BBF0203010001"
/>
<PackageFile
Name="x64\sqllocaldb.msi"
HomeSite="sqllocaldb_64"
PublicKey="3082010A0282010100E57C2F2D0CA9EC7AA834E04C3F7F490E0DB615AD1913DE528A26991571A962270737A5833082626C0BA3FD060D171406E6E0ADCC95960A205AA296E1E057303C5D629BC55D890CD034DFD9D8FA35EF11238BC0F9EB4AF439DA2F7110EB11B32C37A370E886173EEF2A46D08EC7B94800A137F1C7C8E7D21E6B4A2AF2C64C1D709F7CC368428E3CED811A52E33E32943D7E18F19BE44B5C11E4D6C3851E6C033073BCC9A8017D9DADD1F573F05B1A7B2F1F8B32BEB38EB53BD9F7FFF35FB3137C139357B8A05E359883A13434F2C5049FB9FE46170C91DFEF0F55F6ECCC39C96165A129EEBE11371BB76E4255C9CC35D152B303709C98349E2936A917195F0BBF0203010001"
/>
</PackageFiles>
<Commands Reboot="Defer">
<Command PackageFile="x86\sqllocaldb.msi" Arguments="IACCEPTSQLLOCALDBLICENSETERMS=YES" EstimatedInstallSeconds="90">
<InstallConditions>
<FailIf Property="VersionNT" Compare="ValueNotExists" String="InvalidPlatformOS" />
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.1" String="InvalidPlatformOS" />
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
<BypassIf Property="sqllocaldbVersion" Compare="VersionGreaterThanOrEqualTo" Value="2014.120.2000.8" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="1641" Result="SuccessReboot" />
<ExitCode Value="3010" Result="SuccessReboot" />
<DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
<Command PackageFile="x64\sqllocaldb.msi" Arguments="IACCEPTSQLLOCALDBLICENSETERMS=YES" EstimatedInstallSeconds="90">
<InstallConditions>
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
<BypassIf Property="sqllocaldbVersion" Compare="VersionGreaterThanOrEqualTo" Value="2014.120.2000.8" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="1641" Result="SuccessReboot" />
<ExitCode Value="3010" Result="SuccessReboot" />
<DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
Within the folder create another folder called en and create another xml file called package.xml
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" LicenseAgreement="Eula.txt" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles>
<PackageFile Name="Eula.txt" />
</PackageFiles>
<Strings>
<String Name="Culture">en</String>
<String Name="DisplayName">SQL Server 2014 Express LocalDB</String>
<String Name="sqllocaldb_32">http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2032BIT/SqlLocalDB.msi</String>
<String Name="sqllocaldb_64">http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2064BIT/SqlLocalDB.msi</String>
<String Name="AdminRequired">You do not have the permissions required to install SQL Server 2014 Express LocalDB. Please contact your administrator.</String>
<String Name="GeneralFailure">An error occurred attempting to install SQL Server 2014 Express LocalDB.</String>
<String Name="InvalidPlatformOS">The current operating system version does not support SQL Server 2014 Express LocalDB.</String>
<String Name="InvalidPlatformOSServicePack">The current operating system does not meet Service Pack level requirements for SQL Server 2014 Express LocalDB. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String>
</Strings>
</Package>
Copy the C:\Program Files\Microsoft SQL Server\120\License Terms\License_SqlLocalDB_1033.txt file into the en folder and rename it to eula.txt.
To install the package copy the folder SqlLocalDB2014 to where your other bootstrapper packages are located e.g. C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages
You should now be able to use the package from Visual Studio, however if you wish to have the component installed from the same location as your application then you'll need to download the two sqllocaldb.msi files specified in the package.xml file and put them in x86 and x64 folders inside the SqlLocalDb2014 folder.
Lastly, this package is only for English but you may support multiple languages by adding folders for each language with package.xml and eula.txt files.
I'm having exactly the same problem as well. I found one potential answer at the MSDN forum and it seems to work for me.
To summarize the answer from the link: You have to create a "bootstrapper" for LocalDB 2014. This is just a folder in your "Microsoft SDKs directory" containing some specific xml files with keys/meta-data and an eula text file. The answer in the link provides the content for these xml files. After restarting visual studio, "Sql Express 2014 LocalDB" will appear along with all the other prerequisites and can be added to ClickOnce dependencies.
The solution for Localdb2017
Copy the SqlLocalDB2017 folder into the proper place e.g.: c:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages and restart Visual Studio.
Here is a simple and complete description on how to add SqlLocalDB 2014 ClickOnce Bootstraper in Visual Studio.
If you want to include sqllocalDB setup files you just got to download them from the links in the package.xml file. But it seems that the sqllocaldb_x64.msi is wrong and it does not install on x64 windows (tested on Windows 7 x64 sp1).

VS 2010 Bootstrapper package

I'm trying to create bootstrapper package for Visual Studio 2010. It has appeared in prerequisites window. Here is my product.xml
<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="FaroLS" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="true">
<PackageFile Name="faro ls 5.2.0.35213 x64 setup.exe" />
<PackageFile Name="example.faro.ls.exe.manifest" />
<PackageFile Name="faro.ls_5.2.0.35213.msi" />
<PackageFile Name="farolsdemoscans.zip" />
<PackageFile Name="faroopendemoapp.zip" />
<PackageFile Name="farosdkdemoapp.zip" />
<PackageFile Name="unins000.dat" />
<PackageFile Name="unins000.exe" />
<PackageFile Name="vcredist_x64.exe" />
<PackageFile Name="vcredist_x64_90.exe" />
</PackageFiles>
<InstallChecks>
<RegistryCheck Property="IsInstalled" Key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FARO LS_is1\" Value="Inno Setup: Setup Version"/>
</InstallChecks>
<Commands Reboot="Defer">
<Command PackageFile="faro ls 5.2.0.35213 x64 setup.exe">
<InstallConditions>
<BypassIf Property="IsInstalled" Compare="VersionGreaterThanOrEqualTo" Value="5.1.6" />
</InstallConditions>
<ExitCodes>
<DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
File example.faro.ls.exe.manifest
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='FARO.LS' version='1.1.502.0' processorArchitecture='amd64' publicKeyToken="1d23f5635ba800ab"/>
</dependentAssembly>
</dependency>
</assembly>
To determine whether i have already installed this product i'm checking registry entry
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FARO LS_is1\Inno Setup: Setup Version
And now the bad things. Registry check does not work. Every time i launch product setup it asks me to install additional component, even if it is already installed.
And when installation starts i get error:
Setup has detected that the file 'C:\Users\user\AppData\Local\Temp\VSD1F0C.tmp\FaroLS\faro ls 5.2.0.35213 x64 setup.exe'
has either changed since it was initially published or may be corrupt.
See the setup log file located at
'C:\Users\user\AppData\Local\Temp\VSD1F0C.tmp\install.log' for more information.
I found some similar topics on stackoverflow, where .net 4.5 caused this problem. But i don't have one installed.
File faro ls 5.2.0.35213 x64 setup.exe does not have digital signature. Can it cause errors? Are there any ways to make it work?

WiX 'Bundle' 'ExePackage' 'DetectCondition' is always false

I am trying to create a WiX bundle that installs the .NET Framework 4.0 before my MSI installer. I inspected the log file for my bootstrapper using the command line argument \l log.txt and discovered that the ExePackage::DetectCondition is always evaluating to false.
I am including WixNetFxExtension.dll as a reference in my Visual Studio 2010 Windows Installer XML Bootstrapper project.
I am including the NetFxExtension namespace:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
Providing the basic bundle framework:
<Bundle Name="RSA Bootstrapper"
...
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
...
<Chain>
<PackageGroupRef Id="NET40" />
<PackageGroupRef Id="RSA_Application" />
</Chain>
</Bundle>
...
I am including the <PropertyRef Id="NETFRAMEWORK40FULL" /> in the fragment and then going on to define the ExePackage for .NET Framework 4.0 (NET40):
<Fragment>
<PropertyRef Id="NETFRAMEWORK40FULL" />
<PackageGroup Id="NET40">
<ExePackage SourceFile="dotNetFx40_Full_x86_x64.exe"
Compressed="yes"
Cache="yes"
DetectCondition="NETFRAMEWORK40FULL"
InstallCommand="/norestart /passive /showrmui /ACTION=Install"
Permanent="yes"
InstallCondition="NOT NETFRAMEWORK40FULL"
Vital="yes" >
<ExitCode Value="0" Behavior="success" />
<ExitCode Value="1641" Behavior="scheduleReboot" />
<ExitCode Value="3010" Behavior="scheduleReboot" />
<ExitCode Behavior="error" /> <!-- Everything else is an error -->
</ExePackage>
...
I have also checked the Visual Studio build output to confirm that the WixNetFxExtension.dll is referenced correctly:
C:\Program Files (x86)\WiX Toolset v3.7\bin\Light.exe ... -ext "C:\Program Files (x86)\WiX Toolset v3.7\bin\WixNetFxExtension.dll"
The problem is with the DetectCondition property. No matter what I set it to, it evaluates to false.
Thinking that maybe the NETFRAMEWORK40FULL reference cannot be trusted, I tried using this instead:
<Fragment>
<Variable Name="isInstalled"
Type="numeric"
Value="0"
Persisted="yes"
bal:Overridable="yes"/>
<util:RegistrySearch Id="FindInstallKey"
Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install"
Result="exists"
Variable="InstallKeyExists" />
<util:RegistrySearch
Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install"
Variable="isInstalled"
After="FindInstallKey"
Condition="InstallKeyExists = true"
Format="raw" />
</Fragment>
Setting DetectCondition="isInstalled" or DetectCondition="isInstalled = true" always evaluates to false. Even setting DetectCondition="true" always evaluates to false!
Here is a log snippet of what I am talking about, with DetectCondition="true"
[16A0:17B4][2013-02-13T13:01:43]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe, cmdline: '/l log.txt -burn.unelevated BurnPipe.{33090847-CC78-445B-BAAA-564B840B7E8E} {38F95C6A-EC0F-4402-951B-FABFC5827CB6} 6296'
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\log.txt'
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe'
[16A0:17B4][2013-02-13T13:01:43]i052: Condition '((VersionNT = v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT = v5.2) AND (ServicePackLevel >= 2)) OR ((VersionNT = v6.0) AND (ServicePackLevel >= 1)) OR (VersionNT >= v6.1)' evaluates to true.
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleName' to value 'RSA Bootstrapper'
[16A0:17B4][2013-02-13T13:01:43]i100: Detect begin, 2 packages
[16A0:17B4][2013-02-13T13:01:43]i052: Condition 'true' evaluates to false.
[16A0:17B4][2013-02-13T13:01:43]i103: Detected related package: {D431417D-F0AC-4CFB-8E25-E27F5B8101D9}, scope: PerMachine, version: 2.1.15.0, language: 0 operation: MajorUpgrade
[16A0:17B4][2013-02-13T13:01:43]i101: Detected package: dotNetFx40_Full_x86_x64.exe, state: Absent, cached: None
[16A0:17B4][2013-02-13T13:01:43]i101: Detected package: RSA_Preset.msi, state: Absent, cached: None
[16A0:17B4][2013-02-13T13:01:43]i199: Detect complete, result: 0x0
[16A0:17B4][2013-02-13T13:02:04]i200: Plan begin, 2 packages, action: Install
[16A0:17B4][2013-02-13T13:02:04]i052: Condition 'NOT NETFRAMEWORK40FULL' evaluates to true.
Specifically,
i052: Condition 'true' evaluates to false.
and actually Condition 'NOT NETFRAMEWORK40FULL' evaluates to true. even though I have .NET 4.0 Full installed and can manually find the .NET 4.0 entry in my registry, both in the usual spot and under HKLM\SOFTWARE\Wow6432Node (I am on a 64 bit system).
Am I missing something? Why doesn't DetectCondition work for me? The project compiles, runs, deploys the payload(s) and otherwise works fine.
<PropertyRef Id="NETFRAMEWORK40FULL" /> is a reference to an MSI property but you're creating a bundle. Bundles have variables that are distinct from MSI properties, though Burn itself provides a number of bundle variables that mimic those that MSI provides.
That said, WixNetFxExtension provides package groups for the 4.0 NetFx installers. You can replace all that with a simple <PackageGroupRef Id="NetFx40Redist" />.
Variables like NETFRAMEWORK40FULL are MSI variables, you cannot use them in Bundles.
I have successfully embedded the .NET Framework 4.0 Client Version within my bundle. Conditions variables resolved from the Registry.
Notice the syntax "<<" (which translates to <<) in DetectCondition attribute. This page may help http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/expression-syntax
<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle
Name="My Program Name"
Version="1.2.0"
Manufacturer="SUSU"
UpgradeCode="some-guid">
<Chain>
<PackageGroupRef Id="Netfx4"/>
<MsiPackage Id="MyProgramInstaller" SourceFile="product.msi" Compressed="yes"/>
</Chain>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="license.rtf"
ShowVersion="yes"
/>
</BootstrapperApplicationRef>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version"
Variable="Netfx4ClientVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version"
Variable="Netfx4x64ClientVersion" Win64="yes" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
Variable="Netfx4x64FullVersion" Win64="yes"/>
<PackageGroup Id="Netfx4">
<ExePackage
Id="Netfx4"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="c:\Downloads\dotNetFx40_Client_x86_x64.exe"
InstallCommand="/q"
DetectCondition="(Netfx4FullVersion << "4") OR (Netfx4ClientVersion << "4") OR (Netfx4x64ClientVersion << "4") OR (Netfx4x64FullVersion << "4")"
/>
</PackageGroup>
</Fragment>
</Wix>

VSTO install package How to check for prerequisites and skip them

I created Setup project for my Excel add-in project according to the article:
Deploying a Visual Studio Tools for the Office System 3.0 Solution for the 2007 Microsoft Office System Using Windows Installer
http://msdn.microsoft.com/en-us/library/cc563937(office.12).aspx
I add prerequisites such as 2007 Interop assemblies(Office2007PIA) and when
I run my setup file it does install it.
But the problem is :
That my setup ALWAYS installs it even if my computer already has
Office2007PIA.
How can I configure my setup project that it will first check if
Office2007PIA is installed and continue the installation of my project
without installing Office2007PIA?
Here is the code from "c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\en\package.xml":
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
>
<!-- Defines a localizable string table for error messages. -->
<Strings>
<String Name="DisplayName">2007 Microsoft Office Primary Interop Assemblies</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install the 2007 Microsoft Office Primary Interop Assemblies. Contact your administrator.</String>
<String Name="GeneralFailure">A failure occurred attempting to install Microsoft Office 2003 primary interop assemblies.</String>
</Strings>
</Package>
And here is the code from
"c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\en\package.xml" "c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\product.xml":
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Office.PIA.2007"
>
<RelatedProducts>
<DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
</RelatedProducts>
<!-- Defines the list of files to be copied on build. -->
<PackageFiles>
<PackageFile Name="o2007pia.msi"/>
<PackageFile Name="ComponentCheck.exe"/>
</PackageFiles>
<InstallChecks>
<ExternalCheck
Property="Office2007Exists"
PackageFile="ComponentCheck.exe"
Arguments="{0638C49D-BB8B-4CD1-B191-050E8F325736}"/>
</InstallChecks>
<!-- Defines how to run the Setup package. -->
<Commands Reboot="Defer">
<Command PackageFile="o2007pia.msi"
Arguments=""
EstimatedInstalledBytes="30000000"
EstimatedInstallSeconds="60"
>
<InstallConditions>
<BypassIf Property="Office2007Exists" Compare="ValueNotEqualTo" Value="0" />
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
I suppose you mean product.xml is missing code (in node InstallConditions):
<BypassIf Property="PIAInstallAction" Compare="ValueNotEqualTo" Value="0" />
?
My guess is that the installation is not done with administrative permissions as this is a requirement when installing assemblies to the GAC.
If you want to dig deeper you can analyze the process how the PIA installation is triggered:
Whether the Office PIA are installed is determined by a small executable included in the setup bootstrapper that checks if the PIA are actually present on disc.
The executable is named ComponentCheck.exe and is typically located under
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIARedist
I suggest you run this program and check with Process Monitor whether anything fails. Based on the exit code of ComponentCheck.exe the installation of the PIAs is triggered or not.
This exit code condition is specified in the file package.xml in the same folder:
<InstallConditions>
<BypassIf Property="PIAInstallAction" Compare="ValueNotEqualTo" Value="0" />
<!-- Requires the user to be an admin user when installing the prerequisite -->
<FailIf Property="AdminUser" Compare="ValueEqualTo"
Value="false" String="AdminRequired" />
</InstallConditions>

Visual Studio Setup & Deployment: Adding Pre Requisits

How can I add into Setup & Deployment project that I want to the client has more components, like:
Microsoft Chart Controls
Microsoft SQL 2008 Express Edition (not 2005)
etc...
alt text http://img55.imageshack.us/img55/2586/200902021225eu9.png
This options are not in VS 2008, and in the window (image above) it only has a link to "Check Microsoft Update for more Redistributable components" but it goes to a page with 2 "bootstrapper packages" (I don't even know what's this)
any ideas on how to add this to the project instead asking the users to install this manually?
Thank you.
Have a look at the article
Authoring a Custom Bootstrapper Package for Visual Studio 2005
If you locate a folder
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages (VS 2005)
or, for VS 2008,
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
Each folder under 'Packages' is the prerequisite you see in the list, as shown on your screenshot.
So, if you want to add an application called MyPrereq as a prerequisite, you need to make your own folder 'MyPrereq' under 'Packages'. Then you make a product.xml file similar to this
<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="MyPrereq" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="MyPrereq.exe" />
</PackageFiles>
<InstallChecks>
</InstallChecks>
<Commands Reboot="None">
<Command PackageFile="MyPrereq.exe" EstimatedInstallSeconds="90">
<InstallConditions>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
and your package.xml file similar to this
<?xml version="1.0" encoding="utf-8"?>
<Package Name="MyPrereq" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<Strings>
<String Name="Culture">en</String>
<String Name="DisplayName">MyPrereq</String>
<String Name="GeneralFailure">A fatal error occurred. The installation failed.</String>
</Strings>
</Package>
and place these files and your setup package (MyPrereq.exe) in the folder. Check the existing packages as an example to see where to place files.
If you do everything properly, you will be able to see your MyPrereq option in the list of "Choose which prerequisites to install".

Resources