App.Config change doesn't affect My.Settings?

P

Pieter

Hi,

I'm using the Settings.settings of VB.NET to define a Connectionstring
(Scope = application). When I deploy the Solution, and change this Setting
in the app.config-file, it seems that itdoesn't affect the Application at
all! It still uses the old value. Are the Settings.Setting hardcoded
somewhere
in the application?

I can't find any documentation of this subject, or anyway how I should do
it... Any help woudl be really appreciated!

Thanks a lot in advance,

Pieter
 
B

Bajoo

Dear Pieter,
Are you changing the Values after application starts?
cause this wont change until the app restarts. and can you please show
the code you are using to change the App.Config

Regards,
Naveed Ahmad Bajwa
http://bajoo.blogspot.com/
 
P

Pieter

Hi,

I'm jsut changing the App.Config with notepad (not in the application but
manually.

These are the steps:
- I install the application
- I go the the folder (C:\Program Files\MyApplication\"
- I open the file MyApplication.exe.config with Notepad, and I change the
connectionstring
- I close the Myapplication.exe.config, and start Myapplication.exe
-> it still takes the old value (which isn't anymorei n the App.config...)

I didn't create the App.config or didn't change anything in it. when I
delete it the Settings.settings re-create it automaticly..

This is my application.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MyApplication.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="MyApplication.Settings.MainConnectionString"
connectionString="Data Source=MyServer;Initial Catalog=MyDataBase;Integrated
Security=True" />
</connectionStrings>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for
My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the
Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME
with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog"
type="System.Diagnostics.EventLogTraceListener"
initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<userSettings>
<MyApplication.Settings>
<setting name="LastClientID" serializeAs="String">
<value>0</value>
</setting>
</MyApplication.Settings>
</userSettings>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top