Steps to create setup file in Visual studio 2012 with database.

In this post i will show the steps to create an setup file in visual studio 2012 with database. I was searching from about month for how to create setup with database but everywhere same thing only i was getting i.e without database. As we know vs2012 and newer version dont have setup and deployment option so we have to use installshield LE to create setup but the setup created with that dont work on client or other pc if it has some database. I have tried and different method to create setup without using it, and it worked for me just give a try and let me know if it works for you or not.

Below are the steps.


STEP 1

Create and empty project in vb or C#. here i have created one form and placed gridview in it.




STEP 2

Then Right click on your project name in solution explorer and select Add > New Item and choose Service-based Database. you can rename your database name with yours or any.



STEP 3

Then Double click on Database1.mdf  and create and table. i have created table and inserted some data into it.



STEP 4

Then i am binding my gridview with database. to do that click on small arrow on gridview > choose other source> database>dataset> choose your database>next>select the table>finish and it will be binded.




STEP 5

Now the main thing about creating setup. Click on Build option and select publish option. now here choose the location where you want to publish the app. here i have selected desktop and selected one folder on desktop and click open.

Note:-please create an folder and select it so all files goes to one place. 



STEP 6

Now select the method from where user can install your application. i have choosen cd-rom option and click on next.




STEP 7

In next step choose whether your application checks for update from some particular location or not and click next.




STEP 8

Now your application is ready to publish click finish and it will create an setup.



It is the simple way to create an setup with database and when you will install this setup file in client pc it will work. i have tested with 3 different pc and it worked in all pc, just make sure client pc must have .net framework 4.0 and above.

Please let me know if its work for you or not in comments. and if it works then please do share this post so other who are facing same problem can see it. if i will get another solution to create setup with database i will make an another post for it.

Thank you.

Comments

  1. dear Pushpesh Pandey its really helpfull...but i need to Attach my sql server management studio database .mdf file.
    my application is working perfectly but during setup project plz tell me how can i attach existing sql server databse i have already

    ReplyDelete
  2. Actually i dont need this..i want step by step procedure to create setup project in visual studio 2012 and attachment of sql server management studio database(.mdf) and what kind of changes i have to do in my connection string..plz inform me when you find a solution...

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  3. Replies
    1. im still trying but not getting proper success. i have asked 2 3 person who works from years in mnc companies they have told me that we have to install database on client pc then only it works, and even i have asked visual studio official page but they are not evn bother to reply. but still i will try my best.

      Delete
    2. hmmmmm ook.bcoz i did't find any solution i just changed my database type.now i m using sql compact i successfully deployed my project.

      Delete
  4. is it the same for ms.access database ? thanks a lot

    ReplyDelete
    Replies
    1. yes it will work, just create your database in your project folder so while creating setup it get attached to setup file.

      for example your project folder name is abc then create database inside abc folder or set path of database file to abc folder so it dont give problem.

      Delete
    2. Ok i'll try this and say you if it works.

      Delete
  5. not working for me :(

    my access file is locate here:

    Dim conn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Bdd.mdb")

    i have trying to by putting
    Public dbPathAccess As String = Application.StartupPath & "\Bdd.mdb"

    but no way, when i try to put the exe on my other computer it can't find the bdd !

    ReplyDelete
  6. is your bdd.mdb file is situated inside your project folder?

    ReplyDelete
  7. Replies
    1. have you tried to create the setup file through other way like with help of installshield? coz something works with it and something doesnt. give one try with that, till then i will find some solution for u. u using vs 2012 ryt?

      Delete
    2. you A program work like a charm, i don't know why mine won't work ? what is you path for you access db file in vb.net ?
      System.Data.OleDb.OleDbConnection("Provider= ?
      thanks a lot for your help

      Delete
    3. dont do this "Public dbPathAccess As String = Application.StartupPath & "\Bdd.mdb" ", instead do one thing, delete the data source or dataset which you have created and place your .mdf file inside your project folder, and create new datasource and select the path where .mdf file is saved and connect dats it and it work for you too. my path was like E:/projects/windowsapplication1/db1.mdf.

      your connection will be like this "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db1.mdb"

      Delete
    4. you will find this in your app.config file

      Delete
    5. ok let's try this :D say you if it's working
      :D

      Delete
  8. was looking for a long time for a solution for attaching a database to application... ill try it and tell u whether it works or noyt.
    thank you...

    ReplyDelete
    Replies
    1. yes do try and let me know if problem comes :)

      Delete
  9. Hi i m Er. vikas kumar software developer Please tell me how to make a perfact setup with .mdffile and that setup file also run in another system.

    Upload video

    ReplyDelete
    Replies
    1. this are step by steps instruction of creating the setup. i will publish video soon.

      Delete
  10. this isn't working for me in another computer.

    ReplyDelete
  11. Hi kartik, can you just tell me what error or problem you facing.

    ReplyDelete
  12. do I need to have the sql server installed on the other computer?

    ReplyDelete
  13. please i make every step u said but no data can show ...and error was "unhandled expection has occurred in your application.the application will ignore this error and attempt to continue if you click quit,the application will close immediately.
    A Network -related or instance-specifiesd error occured........." its a long error that cannot reach the data >>please helpe me i cannot find any solution and i did like what u said and the data is enternal...but i didnt install the VS or mSQL in the client computer

    ReplyDelete
    Replies
    1. sorry for very late reply, that error occured because your application was not able to find sqldb in pc/location. you can just install sqllocal db in pc and it will work for you.

      Delete
  14. I am new to C# programming , so can you please tell me ,why does it require .NET Framework 4.0 and above on client's computer??

    ReplyDelete
    Replies
    1. hi, it depends on which framework you are working. example if you are creating application using 3.5 framework then client pc needs 3.5 framework installed then only your application will work.

      Delete
  15. Hey. I am getting an error: "Application Validation Did Not Succeed. Unable to continue"

    ReplyDelete
  16. I am using Visual Studio 2015 with sql .mdf database

    ReplyDelete
    Replies
    1. are you getting error while installing in client pc?

      Delete
    2. Yes.
      My solution has 2 projects. One dealing with the GUI and the other dealing with the classes

      Delete
    3. if you are using 4.5 or above framework then you have to install same on client pc. this error comes usually comes with it,

      Delete
    4. try this solution, open your project clean the solution from build menu then again build setup. it will clean the solution so that error should be fixed.

      Delete
  17. I was barely amazed at how you had written this content. Please keep posting.
    DOT NET Training in Chennai
    DOT NET Course in Chennai

    ReplyDelete
  18. Subscription boxes are a type of boxes which are delivered to the regular customers in order to build goodwill of the brand. They are also a part of the product distribution strategy. As a woman, you should subscribe to these boxes to bless yourself with a new and astonishing box of happiness each month. visit mysubscriptionsboxes

    ReplyDelete
  19. It was helpful for me and guide my career good nothing to say in the words abouts this i suggested to everyone try this and will bet good career,

    ReplyDelete
  20. 5666ACelia566EB14 April 2024 at 15:12

    959AF
    ----
    ----
    ----
    ----
    ----
    matadorbet
    ----
    ----
    ----

    ReplyDelete

Post a Comment

Popular posts from this blog

POT Coin Faucet

Earn Bitcoin from Android app which really pays