Office Excel 2007 Add-in is not reading app.config in Win7 64 bit Office 2010 32 bit machines under deployment RRS feed

  • Question

  • Hi,

    My application works like this,
    1. The Office 2007 Excel Add-in reads information from the App.Config file.
    2. Uses that information to various purposes within the application.

    I have got a strange problem in Win7 64 bit and Office 2010 32 bit/64 bit machines when this add-in is deployed. There is no need to create a new add-in for Office 2010 as your Office 2007 add-in will be compatible there.
    The configuration file is not read and there is no information to use and so the application fails subsequently. This happens in deployment scenario alone.

    Please refer to the attached sample add-in which is created closely to my requirement.
    1. You need to have a file C:\Test.log before running this project. This will save some information as log.
    2. Build the project and build the setup project seperately. The setup file will be available in ${proj_folder}\ExcelAddInSetupProject\Debug\.
    3. In debug mode things will work fine. On installing the setup file, the configuration file will not be read.
    4. Specifically the following codes are not working.

            string[] names = ConfigurationManager.AppSettings.GetValues("Name");
            if (names != null && names.Length > 0)
              name = names[0];
      string un = System.Configuration.ConfigurationSettings.AppSettings["Name"];

    Can you please let me know why this happens? Is there any fix for this?

    Sample Application:

    Thursday, August 25, 2011 8:23 AM


  • I am taking a look at your setup project and I notice that it targets x86. That is all fine and good, but it will not add the custom registry keys to a x64 registry hive. You need a seperate project or a custom action. With a VSTO x86 setup project you can not write to a x64 registry! I will point to you an article so you don't have to take my word for it! Also there is another problem with dealing with x64 O/S and (x86 app vs x64 app) if it is an x86 app it must be set in the  HKLM or HKCU\Software\Wow6432Node. Here are some article you can take a look at hope this helps!


    You cannot have a single MSI that will install for 32-bit as well as 64-bit Office versions. You must create two
    separate MSI packages that target the 32-bit and 64-bit versions of Office separately.


    4) Installing on 64-bit Operating Systems

    Unlike the HKCU registry hive, the HKLM registry hive for Office add-ins is redirected on a 64-bit Windows OS. So if you are trying to register an add-in with 32-bit version of Office running on a 64-bit OS, the add-ins registry will be under the WOW6432Node. The 32-bit Office running on 64-bit OS will always load the add-ins listed under this key.


    Let me know if you have any troubles after this I will try to take a look at it...


    Saturday, August 27, 2011 12:33 AM