none
How to create install package for app using local SQL server database RRS feed

  • Question

  • I wrote a small app to learn more about SQL and experiment with Entity Framework. Users of my app will not be sharing databases; each will have their own. On first execution, my app creates the database locally, and after that opens the existing database. So far, so good - it works pretty well on my laptop, which has SQL Server 2017 installed.

    I tried copying the assemblies to my desktop machine and that also worked as expected, though SQL Server was not installed.

    But when I tried copying the assemblies to another laptop, the app would not run. The exception I saw was:

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The Server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a local Database Runtime Installation. Verify SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)"

    All machines are Windows 10. (Is it significant that the desktop machine has Visual Studio 2019 installed?)

    I don't want other users to be required to install SQL Server (Express, or otherwise). What do I need to include in my installation?

    Can it be done more-or-less automatically by using ClickOnce deployment (a.k.a. Publishing Wizard)? Or do I need to build an .msi with Wix code?

    Is SQLite a better option for this?

    I have seen mention of SQL Server Compact Edition, but when I tried to run this down, it seemed like this is no longer available from Microsoft. And I believe I'm already using SQL Server Express (looks like this is confirmed by the error message, above)...
    Wednesday, April 1, 2020 9:58 PM

Answers

  • Hello,

    This page will addressing an install of SQL-Express. SQL-Server Compact Edition provider is available for EF Core on the following page.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by thoatson Wednesday, April 8, 2020 11:53 PM
    Thursday, April 2, 2020 12:24 AM
    Moderator

All replies

  • Hello,

    This page will addressing an install of SQL-Express. SQL-Server Compact Edition provider is available for EF Core on the following page.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by thoatson Wednesday, April 8, 2020 11:53 PM
    Thursday, April 2, 2020 12:24 AM
    Moderator
  • Hi thoatson,

    Thank you for posting here.

    In general, all users of the application will connect to the database server provided by the publisher.

    But since you decided to let users use their local database, it is necessary to have a database on the user's computer.

    The reason why your application can run on your desktop machine is indeed related to you have installed Visual Studio 2019.

    For Visual Studio 2019, during Visual Studio installation, if you choose the ASP.NET and web development workload, it will include SQL Server Express LocalDB, or you can select SQL Server Express LocalDB in Individual components.

    I don’t know if there is any way for users to use related functions without installing SQL Server, it seems impossible.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, April 2, 2020 2:16 AM
  • I was able to get the package for SqlLocalDB2017 so I could select it from within Visual Studio as a prerequisite for my install.  I may yet try to embed it in my installer.  Thanks for the pointers that got me started in the right direction.
    Wednesday, April 8, 2020 11:52 PM
  • For Visual Studio 2019, during Visual Studio installation, if you choose the ASP.NET and web development workload, it will include SQL Server Express LocalDB, or you can select SQL Server Express LocalDB in Individual components.

    One can also add a MS SQL Server Express MDF file using Localdb for a project by using Visual Studio's Service Based Database off of 'Add New Item\Data'.

    Thursday, April 9, 2020 2:06 AM
  • Thanks, @DA924x, for this tip.  I'll have to look for this when I have a chance to upgrade.
    Thursday, April 9, 2020 5:37 PM