Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an Demo Application made on windows form in c# and I have used Sql Server Compact 4.0 as its database. Now I need to use the same application on another system which doesn't have visual studio or Sql-Server installed in it. Now what all I need to install on that system so that my application runs effectively ?
I don't want to install visual studio or SQL-server in it and for that only i have used SQL-server compact 4.0 but its asking for visual studio service pack-1 to be installed.
I have already installed .net framework and sql server compact 4.0 in it.
Please help me with solutions and any suggestions will also be heartly accepted.
Thanks in advance.
Posted

1 solution

If you have installed SQL Server Compact 4.0 on the target machine, your app must work without additional installations.

If you want to distribute your app with embedded SQL Server Compact, do the following:

1. Add "C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private" content to you app including the amd64 and x86 subfolders. Set the Build Action as Content and Copy to Output Directory as Copy if newer for all the items. This is the "Private" deployment.

2. Add the following code in the app.config:
<configuration>
    <system.data>
        <dbproviderfactories>
            <remove invariant="System.Data.SqlServerCe.4.0" />
            <add name="Microsoft SQL Server Compact Data Provider 4.0">
                invariant="System.Data.SqlServerCe.4.0"
                description=".NET Framework Data Provider for Microsoft SQL Server Compact"
                type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> 
        </add></dbproviderfactories>
    </system.data>
</configuration>


This code targets to the 4.0.0.1 version.

That's all. Your app will work with SQL Server Compact databases on any x64/x86 machine.
 
Share this answer
 
Comments
kool15th 3-Jan-14 5:58am    
Actually Sql Server compact 4.0 is asking for visual studio 2010 sp1 to be installed first than to install sql server compact 4.0 further without that its installation is giving error.

And for Sql servercompact 4.0 I have got only one setup file. While for 3.5 version I got two different setup files for 64bit and 32bit seperately. Then How to make subfolders as you mentioned above ?

I have installed SSCEVSTools-ENU for 4.0 version. Should I download some the setup for 4.0 version ?
Sergey Vaselenko 3-Jan-14 6:18am    
Install Microsoft SQL Server Compact 4.0 SP1 from here
http://www.microsoft.com/en-us/download/details.aspx?id=30709

You will have the files in the installation folder as mentioned above.
It is a one file that deployes both x86 and x64 files in contrast to 3.5.

See also an article about private deployment:
http://msdn.microsoft.com/en-us/library/aa983326(v=vs.110).aspx
kool15th 8-Jan-14 23:52pm    
Thanks.....
Sergey Vaselenko 9-Jan-14 6:06am    
You are welcome! If the solution solves your task, please, accept it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900