# Changes to VSTOAddin.dll.config not recognized at runtime

• Hi Matthew,

>> However, my situation is a bit more complex. I have 3 Office Add-ins (Word, Excel, PowerPoint) all referencing a common assembly 'common.dll'.

I think this will not work since the “common.dll” is an assembly reference and it is not loaded into an individual App Domain.

For common configurations, I suggest you to use “file” attribute in individual configuration files.

For example:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<appSettings file="path\to\commmon\appSettings.xml" />
</configuration>

appsettings.xml

<appSettings>
</appSettings>

Hope it will help.

Regards,

Jeffrey

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Friday, June 27, 2014 9:50 AM

### All replies

• Using reflection, I can see that each Application Setting has a 'Default Value' set in the class file.

Is it using these values every time? If so, why bother having the .config file stored outside of the Assembly?

I tried stepping through my code and calling Settings.Default.Reload(), Settings.Default.Reset(), Settings.Default.Upgrade() etc and nothing made any difference.

What gives?

Wednesday, June 25, 2014 4:32 AM
• Hi Matthew,

As far as I know if we use the .Net Framework to read the config after you change value when the add-in or application is running.

.Net framework will read the app.config once, and never touch the app.config again. That is why you have to restart the application to pick up the change. (refer to App.config reloading)

If you want to read the seeting from disk every time, I suggest you writing the code to parse the confi file by yourself.

If you have any questions about how to parse XML file, you can get more effective response from .net forums such as Visual C# or Visual Basic forum.

Best regards

Fei

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Thursday, June 26, 2014 4:26 AM
• Hi Fei

I'd really like to avoid writing any extra code.

I've learned a bit more about my problem:

If I create a new Excel Add-in and settings file within this add-in, then everything works fine. ie. I can Close Excel, modify ExcelAddin1.dll.config, restart Excel and my modified values are used.

However, my situation is a bit more complex. I have 3 Office Add-ins (Word, Excel, PowerPoint) all referencing a common assembly 'common.dll'. I'd like to have common settings common.dll.config that are accessed by the 3 office Add-ins.

In this scenario, closing Excel, editing common.dll.config in notepad and restarting Excel does not work. The default settings are always used.

I notice that when executing common.dll lives in a different folder '%appdata%\local\assembly\..'

Obviously VSTO moves files around. is VSTO fogetting to copy common.dll.config?

Friday, June 27, 2014 1:27 AM
• Hi Matthew,

>> However, my situation is a bit more complex. I have 3 Office Add-ins (Word, Excel, PowerPoint) all referencing a common assembly 'common.dll'.

I think this will not work since the “common.dll” is an assembly reference and it is not loaded into an individual App Domain.

For common configurations, I suggest you to use “file” attribute in individual configuration files.

For example:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<appSettings file="path\to\commmon\appSettings.xml" />
</configuration>

appsettings.xml

<appSettings>
</appSettings>

Hope it will help.

Regards,

Jeffrey

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Friday, June 27, 2014 9:50 AM
• Brilliant. Thanks. Much appreciated.
Tuesday, July 1, 2014 1:31 AM
• Actually. I spoke too soon.

I'd prefer to use ApplicationSettings instead of appSettings. Can you see a way of using ApplicationSettings?

Thanks

Tuesday, July 1, 2014 7:29 AM
• Hi Matthew,

ApplicationSettings is using ClientSettingsSection class, I also checked the implementation of this class from sourceof.net, and I’m afraid there are no “File” or similar attributes to specify the location. Sorry for the inconvenience. I suggest you to submit a feedback to Visual Studio User Voice.

Regards,

Jeffrey

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.