My Visual Studio 2010 (C#) application is working, and I've been trying to deploy it using a Setup Project all this week with no success.
I started by following Steve Lasker's Web Blog on Privately Deploying SQL Server Compact with the ADO.NET Entity Provider. It had me modify the project's app.config
file to include the following:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
That installation only ran successfully on PCs where SQL Server CE was already installed (like MY PC only).
I got to looking closer at the article, and noticed it was written in 2008, but that a David V left a comment linking to the SQL CE Team's article Troubleshooting: Privately deploying the SQL Server Compact 3.5 SP2 ADO.NET Entity Framework provider (System.Data.SqlServerCe.Entity.dll) in the application folder does not work. In their article, they said I had to add "assembly binding redirection" (bad link) and append my app.config
file with the following information:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
So, here I am with an Installer that does not install.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="LastRun" value=""/>
<add key="UserName" value=""/>
</appSettings>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Is my app.config
file corrupt?
My application still runs just fine, but the Installer fails to install anything. The Installer's error is always 2727 for a temporary file name that changes:
DEBUG: Error 2727: The directory entry '_1083472CD2EB47548297E3336FCD9A58' does not exist in the Directory table
What should I do about this?
Has anyone successfully deployed a Microsoft SQL CE Server SP2 for a Private instance?
Found a solution on Code Project called Creating a Private Installation for SQL Compact that fixed my problems right up.
Basically, it looks like it all boiled down to the fact that the VS Installer was not creating the folders or copying over the files required by SSCE. The link above goes into detail about how to do just that.
I hope this helps others.