Cannot call AppSettings.Get method in MAP


  • Hi All,

    How to use System.Configuration.ConfigurationManager.AppSettings.Get method in a MAP in BizTalk Server 2009.

    Using inline C# shows compilation erreur explaining "ConfigurationManager Type or namespace doesn't exist.." even if System.Configuration assembly is referenced.

    I know that a solution would be to use an external C# class but is there a more elegant solution or I made a mistake ?



    Wednesday, May 12, 2010 1:53 PM


All replies

  • Hi,

    Please use the following in your C# inlince scripting functoid:

    public string GetConfigValue(string key)
           string value = System.Configuration.ConfigurationSettings.AppSettings.Get(key).ToString();
           return value;

    ConfigurationManager is not available in Map and you can use it in external assembly.  But you can use ConfigurationSettings in inline C# scripting functoid.


    Tariq Majeed


    Please mark it as answer if it helps
    Wednesday, May 12, 2010 2:24 PM
  • The thing you are doing is not supported straightforward. BizTalk saves inline scripts in the Extensible Stylesheet Language Transformations (XSLT) stylesheet defining the map. Because of this, inline scripts may use the same namespaces as any other XSLT stylesheet script. See the available Namespace supported.

    You can use some limited types inside inline scripts as per w3c standards like String, Double. Please refer this link in MSDN to know more about XSLT Stylesheet Scripting

    Please mark it as Answer if this answers your question
    The contents I write here is my personal views, not the view of my employer and anyone else.
    Wednesday, May 12, 2010 2:37 PM

      I would say if you want to store and use any config in BizTalk,  SSO Config store would be the best approach.  Check the following link:

     - SHR




    Wednesday, May 12, 2010 3:23 PM
  • Hi Christophe,

    As Tarik has suggested you can use System.Configuration.ConfigurationSettings.AppSettings to get to it. This has been discussed in this thread:

    And also mentioned in this blog post:


    Thiago Almeida -
    Wednesday, May 12, 2010 8:13 PM
  • Hi Chris,

    As mentioned by Tariq and Thiago. 


    will work perfectly in BizTalk Map. But you cannot test config value in BizTalk map at design time.

    PS: If possible, I would suggest you to store all the BizTalk related config values in SSO database. please go thru the below link to have an idea where to store your custom configuration for a BizTalk solution.




    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    Thursday, May 13, 2010 6:43 AM
  • You can test it in the map at design time by adding the config values to the application configuration file for Visual Studio, devenv.exe.config.

    For Visual Studio 2008 this file is usually found here: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE


    Thiago Almeida -
    Thursday, May 13, 2010 7:27 PM
  • Thanks all for your useful answers.




    Tuesday, May 18, 2010 6:30 AM
  • that helped me wasting more time to find the reason.

    Tuesday, February 22, 2011 3:14 PM
  • What you have suggested will work if we do not use config sections, and direct key is available in AppSettings of BizTalk Config file. But as i have mentioned we are having separate config file which is referred in BizTalk Config. This code is unable to find key and resulting in null reference exception.

    Regards, Dharmendra, Bangalore (India)

    Monday, May 21, 2012 11:07 AM