milani_lucie
asked on
"Click Once" deployment - Changing Configuration File Settings - C# / VB.NET
Hi,
I have done "Click Once" deployment of my application written in C# / VB.NET. Now i want to change the configuration file settings (Ex: Connection String). I do NOT want to do whole deployment once again, because it is a simple configuration setting. And if i change the configuration settings directly, will it work ? Can you please provide me which file i need to touch, .NET commands & steps for dealing with this situation ?
Thanks
I have done "Click Once" deployment of my application written in C# / VB.NET. Now i want to change the configuration file settings (Ex: Connection String). I do NOT want to do whole deployment once again, because it is a simple configuration setting. And if i change the configuration settings directly, will it work ? Can you please provide me which file i need to touch, .NET commands & steps for dealing with this situation ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Which file you need to amend really depends the initial configuration. Whether the initial programmer used application settings or whatever method for connection string.
If he/she used the application settings, then changing just the connection string there will work.
If he/she used the application settings, then changing just the connection string there will work.
If you want to change settings for every user from your server, then you will have to redeploy the app. If you want to change settings on the client machines manually, you would need to find out the folder path of click once app from its shortcut, and then go in and change the appname.exe.config file.
ASKER
Not exactly what i want...
The following code shows how you can store connection strings in App.config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="MyDBConnectionString
connectionString="Data Source=localhost;Initial Catalog=MySQLServerDB; Integrated Security=true" />
</connectionStrings>
</configuration>
Once you have saved your connection string in App.config file you can use System.Configuration.Confi
ConnectionStringSettings conSettings = ConfigurationManager.Conne
ConnectionStringsSettings class provides properties to read connection string settings in your program as following code shows.
string name = conSettings.Name;
string providerName = conSettings.ProviderName;
string connectionString = conSettings.ConnectionStri