none
VSTO - AddIn for Office Outlook 2010 - Visual studio 2010 - App.Config RRS feed

  • Question

  • Hi,

    I have a Outlook 2010 Add-in project in Visual Studio 2010 og beside that project I have a Setup Project. It worked fine. I have set it up and it is possible to build and deploy the setup.msi installer or the files under my projects bin/release folder to the client machine. I have recently added a app.config file to my project. On the App.config file i have set the "Build Action" to None and set the "Copy To Output Directory" to Copy always. Then i have added the file App.Config file to the Setup Project from my projects bin/release folder (after the project build). But when i build the Setup project it is packaging the files:

    XXX.dll.config

    App.config

    When i install the installer then in the application target location we can see both files. The problem is that when i have this in my code:

    MessageBox.Show(ConfigurationManager.AppSettings["Environment"]);

     

    Then it gives me empty. It is looking like my add-in can't read from the app.config file, and maybe it doesnt know about the app.config file.

    If i didn't add the file App.config to the Setup project and build the Setup project , then it will still package the file:

     

    XXX.config.dll (This file also contains the same as the App.Config file)

    XXX is the name of my add-in project.

    What should I do? Am i doing something wrong. It shouldnt be so complicated for my add-in project to read contents from the App.Config file.

    Regarding

    Erkan /DENMARK

     

    Monday, April 28, 2014 12:39 PM

Answers

  • For App.Config change the setting to Copy to Output = Do not copy.

    What you want is the xxxx.config.dll file in the installation target folder, not app.config. Your code should be able to read configuration data from that file at runtime.


    Ken Slovak MVP - Outlook

    Monday, April 28, 2014 1:49 PM
    Moderator

All replies