1 year ago

#281070

test-img

priya

Change config file for Excel Addin

I have created a VSTO Excel Addin in Visual studio. My project included Setting.Settings file and app.config file. Basically, the Settings.Settings file contains some settings required for the addin, which are based on user preference. Currently to publish the Excel Addin, I need to build it everytime according to the user requirements by changing values in Settings.Settings file or app.config value. Is there any way to include App.config file in separate folder while publishing, so that when user runs setup.exe file he can set up the app.config file as per their requirements.

The Settings.Settings file looks like this:

    <?xml version='1.0' encoding='utf-8'?>
      <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" 
       CurrentProfile="(Default)" GeneratedClassNamespace="ExcelAddinProject.Properties" 
       GeneratedClassName="Settings">
       <Profiles />
     <Settings>
      <Setting Name="TabLabel" Type="System.String" Scope="User">
      <Value Profile="(Default)">Testing</Value>
      </Setting>
    </Settings>
    </SettingsFile>

The app.config file looks like this:

    <?xml version="1.0" encoding="utf-8"?>
     <configuration>
       <configSections>
         <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, 
           System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
         <section name="ExcelAddinProject.Properties.Settings" 
           type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, 
           Culture=neutral, PublicKeyToken=b77a5c561934e089" 
           allowExeDefinition="MachineToLocalUser" requirePermission="false" />
         </sectionGroup>
      </configSections>
     <userSettings>
      <ExcelAddinProject.Properties.Settings>
        <setting name="TabLabel" serializeAs="String">
          <value>Testing</value>
        </setting>
      </ExcelAddinProject.Properties.Settings>
    </userSettings>
    </configuration>

After deployment the folder looks like this:

 | ApplicationFiles
     ExcelAddinProject
        ExcelAddinProject.dll.config.deploy
        ExcelAddinProject.dll.deploy
        ExcelAddinProject.dll.manifest
        ExcelAddinProject
        Microsoft.Office.Tools.Common.v4.0.Utilities.dll.deploy
        Microsoft.Office.Tools.Excel.v4.0.Utilities.dll.deploy
        System.Configuration.ConfigurationManager.dll.deploy
        System.Security.AccessControl.dll.deploy
        System.Security.Permissions.dll.deploy
        System.Security.Principal.Windows.dll.deploy
 | ExcelAddinProject    VSTO 
 | setup.exe

The ExcelAddinProject.dll.config.deploy contains global configs, which apply to all users using this addin. I want to be able, to change this config after deployment.

So, how can I change this config file after deployment?

I tried MageUI it seems to work, but it's complicated for the customer to do on their own.

Any answers would be great help, I tried finding answers but nothing seems to work.

Thanks

excel

vsto

clickonce

setup-project

excel-addins

0 Answers

Your Answer

Accepted video resources