Monday, May 7, 2012

SQL server Compact 3.5 deployment with VS2010


Private file–based deployment refers to the process of including the required SQL Server Compact 3.5 DLLs as files in the project (as opposed to a reference to DLLs already on the target computer). If you include the necessary DLLs with the application, the requirement to install SQL Server Compact 3.5 is removed. Therefore, the administrative credentials are no longer needed.
You can use ClickOnce deployment technology for private file–based deployment. If you do, you must remember to clear the SQL Server Compact 3.5 prerequisite so that the Setup program does not install it.

To deploy a SQL Server Compact 3.5 database by using private file–based deployment

  1. To open the Project Designer, in Solution Explorer/Database Explorer, double-click My Project if you are working on a Visual Basic project (or Properties if you are working on a C# project).
  2. Click the Publish tab.
  3. Click Prerequisites and then clear the check box for SQL Server Compact 3.5.
  4. Close the Project Designer.
  5. Go to the directory that contains the SQL Server Compact 3.5 DLLs. These are located in C:\Program Files\Microsoft SQL Server Compact Edition\v3.5.
  6. Select the seven SQL Server Compact 3.5 DLLs and copy them:
    • sqlceca35.dll
    • sqlcecompact35.dll
    • sqlceer35EN.dll
    • sqlceme35.dll
    • sqlceoledb35.dll
    • sqlceqp35.dll
    • sqlcese35.dll
  7. Paste the DLLs into the project in Solution Explorer/Database Explorer.
  8. Select all seven DLLs in Solution Explorer/Database Explorer and open the Properties window.
  9. Set the Copy to Output Directory property to Copy if newer.
    This will replace any earlier DLLs in an existing application with the newer ones if the application is updated.
  10. Click the Show All Files button in Solution Explorer/Database Explorer.
  11. Expand the References node.
  12. Select System.Data.SqlServerCe.
  13. Set the Copy Local property to True.
    Because your development computer has the SqlServerCe DLLs in the global assembly cache, you must configure the application to use the DLLs in the output directory.
  14. Right-click the project in Solution Explorer/Database Explorer and select Publish to open the Publish Wizard.
  15. Complete the wizard to publish the application.
The application is ready to be installed. Go to the location you published to, and install the application to verify.

No comments:

Post a Comment