1

I used ClickOnce for sometime. It works perfectly. However, i am now having problem when i want to publish it to multiple computers from 1 same source.

The connection string which i wrote at the App.COnfig is pointing to the specific computer name. Everytime when i publish, that connectionstring will be published as well. Now problem comes when i want publish to multiple computers. It will definitely trigger error as they are not sharing the same Computer name in the connectionstring

Could you advice?

-------EDIT-----------

Hi i read some post and it refer me to use mageui.exe. Does that help in solving my problem as this problem still unsolved.

VeecoTech
  • 2,073
  • 8
  • 37
  • 49

1 Answers1

1

Use a user-setting instead (via a .setings file). When your app loads, check the setting; if it is missing/blank display a dialog to enter the server name (etc), and use SqlConnectionStringBuilder to form that into a connection-string. Now store that as the setting and save (it should now reappear next time they load).

You might also want to make that available via an options menu somewhere.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Ok, this sound new to me. Let me go explore and test it out. Thanks for the reply – VeecoTech Apr 29 '11 at 06:53
  • @Marc Gravell: When u say store as the .settings, do u meant store the connectionstring in the Properties->Settings.settings ? If there are multiple computers, i will write each computer connectionstring in that .settings file? – VeecoTech Apr 29 '11 at 07:15
  • @belinq I'm saying "let the user enter the DB info"; if you need to define all the configurations up front, the a *resource file* (resx) with some kind of file with the machinename/connection combinations would be good. – Marc Gravell Apr 29 '11 at 07:19
  • @Marc Gravell: I got what your meant now. But how do i save the DB info to the .settings file at run time? i would imagine now to click on the "Configuration" at the menu, and prompt a form to ask for the Db connectionstring. Then save it. Could you share some light how to run time save that? Also, would it still be possible if i do this alteration to a software which i have already deployed? – VeecoTech Apr 29 '11 at 07:35
  • @Marc Gravell: Is this a good way to save it to .settings? http://bhrnjica.wordpress.com/2011/01/30/handling-with-connection-string-at-run-time-in-developing-the-desktop-applications/ – VeecoTech Apr 29 '11 at 07:51
  • @belinq if that allows per-user, maybe; I'd have started from a .settings myself, though – Marc Gravell Apr 29 '11 at 09:38
  • @Marc Gravell: I am afraid i don get you on your last reply. Could you show me a tutorial link on how to save the db info to the .settings file at run time? – VeecoTech Apr 29 '11 at 13:09
  • 1
    @belinq - this is VB and 2005, but it still applies: http://www.codeproject.com/KB/vb/appsettings2005.aspx – Marc Gravell Apr 29 '11 at 13:12
  • @Marc Gravell: i downloaded the program and tested but it did not save anything to the setting file. Seem like the program is not working – VeecoTech May 01 '11 at 06:09