Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# WinForm set ConnectionString and Entity Framework on installation

I use clickonce to deploy my program. the problem is the deployement team have to enter his conectionString on installation and write into app.config.

How can I add a dialogbox (for put the connectionString) in click once deployment ?

Or I have to add setup project into myProg.sln ?

Thanks you in advance

like image 739
user609511 Avatar asked Jan 27 '26 08:01

user609511


2 Answers

What you want to do is not nice. I take it that you want the user to specify a connection string at installation and persist this to your program. Well, this is not a good thing to do, and connections strings are liable to change; with this in mind you need to include a connection string dialog in your code or at least a text box where the user can set a new connection string that your application can use.

You could use the VS2010 database connection dialog that Microsoft have released (download from here). This will do exactly what you want without you having to do the hard work (and for pretty much any remote connection you want).

I hope this helps.

like image 133
MoonKnight Avatar answered Jan 29 '26 02:01

MoonKnight


I suggest you integrate those questions in the software itself, something like this:

  1. user gets your software
  2. user installs the packare (no question here!)
  3. the software upon launch searches for the info it needs. if it doesn't find them, it starts questioning the user.
like image 40
Alex Avatar answered Jan 29 '26 04:01

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!