Sid
Sid

Reputation: 11

Visual Studio publish a Database project

I created in visual Studio a Database-Project and a WindowsForm Application C# that relates to the local Database-Project.

Right now everything is working fine and I want to publish my zpplication to a PC without Visual Studio.

I can create the setup.exe from my WindowsForm without any problems and run it on my PC, where my local SQL Server exists.

If I transfer the setup.exe to the second PC and run it, it is not working, because the SQL Server is missing.

How can I publish or copy my Database-Project/SQL-Server to the second PC without Visual Studio needed?

I do not need the data in the database necessarily. I just need the structure of the database to run my Application.

I thought about bringing both projects in one, but I have lot of DataSets and manually Connectionstrings in my WindowsForm. I do not know how I can change my dataconnection without starting from scratch.

The solution I have in mind is to transfer both projects separately with a USB. First install the Server and afterwards my WindowsForm without Visual Studio.

Any ideas?

Upvotes: 1

Views: 1282

Answers (1)

Pratik Vakil
Pratik Vakil

Reputation: 81

I feel you have to follow the basic steps.

  1. Use any installer to install your project and as a prerequisite, you can install SQL Server on the client computer.

  2. I suggest having a look at Inno Setup, its very easy and there are many samples available to install SQL Server on the client computer as a part of your application setup.

A very nice example of dependency installer with Inno Setup is at https://www.codeproject.com/Articles/20868/NET-Framework-Installer-for-InnoSetup

  1. Generate full SQL Script of the database from your development environment using SQL Management Studio and you can run this script on end-user/client computer using SQL connection through your installer.

Here is an example of how you can do this with Inno Setup. How to use Inno Setup to update a database using .sql script

Upvotes: 1

Related Questions