VSTO 2010 Document-level customization - Unable to find app.config file in C:\program files\


  • I have an Excel 2010 document-level customization that I have deployed with a setup project.   The customization installs successfully on my machine (Windows 7 64 bit) but when I deploy it on client machine, the application is unable to find the app.config file.   The target machine is Windows XP 32-bit.  Ironically, after the install, if I move the install to a folder besides c:\program files\manufacturer\ the application works successfully. 

    I've seen the references to VSTo 4.0 SP1 ( this applies to application-level addins and mine is a document-level customization.

    • Edited by AddOnsInc Monday, May 28, 2012 2:12 PM
    Monday, May 28, 2012 1:38 PM

All replies

  • Hi AddOnsInc,

    Thanks for posting in the MSDN Forum.

    I would recommend you try following scenario to see whether it can help you out:


    <?xml version="1.0" encoding="utf-8" ?>
        <section name="MyValue" type="System.Configuration.SingleTagSectionHandler"/>
      <MyValue value="Hellow World" />


    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml.Linq;
    using Microsoft.Office.Tools.Excel;
    using Microsoft.VisualStudio.Tools.Applications.Runtime;
    using Excel = Microsoft.Office.Interop.Excel;
    using Office = Microsoft.Office.Core;
    using log4net;
    using MyLog4Net;
    using System.Configuration;
    using System.Collections;
    namespace ExcelWorkbook21
        public partial class ThisWorkbook
             * Please omit ILog variable, I just use it to track my program.
            private ILog Log = MyLog4Net.MyLog4Net.Generator1(
                + ".log", typeof(ThisWorkbook), "DEBUG",true);
            private void ThisWorkbook_Startup(object sender, System.EventArgs e)
                + "logReport.log");
                    Configuration cf = ConfigurationManager.OpenExeConfiguration(
                       .Replace(".config", ""));
                    Log.Info("Get the configuration");
                    Hashtable ht = (Hashtable)ConfigurationManager
                    Log.Info("Get the Configuration's Hash Map");
                    Log.Info("Show value");
                catch (Exception ex)
                    Log.Error(string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
            private void ThisWorkbook_Shutdown(object sender, System.EventArgs e)
            #region VSTO Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
                this.Startup += new System.EventHandler(ThisWorkbook_Startup);
                this.Shutdown += new System.EventHandler(ThisWorkbook_Shutdown);

    Have a good day,


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 29, 2012 6:15 AM
  • Hi,

    I had similar issues with a document level addin I wrote - I ended up storing settings inside the document rather than using app.config. I think this has something to do with the application path being Microsoft Word rather than your customisation, so it is looking in the Microsoft Word path for your config file rather than the correct location.

    Can you use :-


    See my post here for some code on how to do this.

    • Proposed as answer by Adam O'Neil Tuesday, May 29, 2012 7:57 AM
    Tuesday, May 29, 2012 7:45 AM
  • Tom,

    The problem that we appear to be having is very similar to the one that you appear to have been involved with in the following thread:

    Our issues is very similar, with VSTO 4.0 SP1, our document-level customization will not read the dll.config file when the Excel workbook and its supporting files (.vsto, .manifest. dll.config, etc) are located in C:\Program Files\{Manufacturer}\{Product}.     The minute that we move the workbook and the supporting files to another folder outside of C:\Program Files\ everything functions as it normally does and the dll.config file is picked up successfully. 

    Like the thread posted above, when I display the value associated with AppDomain.CurrentDomain.SetupInformation.ConfigurationFile when running from C:\Program Files, the value is C:\Progam Files\Microsoft Office\Office14\Excel.exe.config.   When we move the application to a new folder, the value properly represents the location of the .dll.config file.

    Again, we are using a document level customization and not an application-level addin so we do have the ability to modify the registry for the fastpath reference as specified in

    I am using Office 2010, VS 2010, .Net 4.0, VSTO 4.0 SP1.  Please provide some direction if possible. 

    Tuesday, June 12, 2012 4:56 PM