Application Configuration when using SourceCode.Configuration.ConfigurationManager

As part of a configuration re-factoring exercise, configuration entries for Client Tools and Authoring APIs were migrated from .NET machine.config files to the individual application's config files. This change can impact the APIs used to author K2 Projects, SmartObjects and Workflows. If you are building a custom application that makes use of the APIs and the required configuration entries described below are missing, the following exception will get reported:
Error Message: Please ensure that the needed configuration nodes are configured in your configuration file. Please refer to the help documentation for further details.

To resolve this exception, the following configuration entries need to be added in your applications config file:

Copy

Configuration entries

<configuration>
  <configSections>
    <sectionname="sourcecode.configuration"
             type="SourceCode.Configuration.ConfigurationManager,
                   SourceCode.Framework, Version=4.0.0.0,
                   Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d"/>
  </configSections>
  <sourcecode.configuration
            managerConfigFile="%PROGRAMFILES%\K2\Configuration\ConfigurationManager.config"
            productPath="%PROGRAMFILES%\K2\Bin"
            templateConfigFile="" />
  <connectionStrings>
    <addname="HostServer"
             connectionString="Integrated=True;IsPrimaryLogin=True;Authenticate=True; EncryptedPassword=False;Host=[HOSTSERVERNAME];Port=[HOSTSERVERPORT]"providerName="K2"/>
    </connectionStrings>
</configuration>

The sample configuration below is an example of an application configuration file along with other .NET configuration values that may be required.

Copy

Example

<configuration>
  <configSections>
    <sectionname="sourcecode.configuration"
             type="SourceCode.Configuration.ConfigurationManager, SourceCode.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d"/>
  </configSections>
  <startupuseLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntimeversion="v4.0"sku=".NETFramework,Version=v4.5"/>
  </startup>
  <sourcecode.configuration
             managerConfigFile="%PROGRAMFILES%\K2\Configuration\ConfigurationManager.config"
         productPath="%PROGRAMFILES%\K2\K2\Bin"
         templateConfigFile="" />
  <connectionStrings>
    <add
    name="HostServer"
    connectionString="Integrated=True;IsPrimaryLogin=True;Authenticate=True; EncryptedPassword=False;Host=localhost;Port=5555"
    providerName="K2"/>
    </connectionStrings>
</configuration>