There are times when you need to create a new Session (i.e. Tridion.ContentManager.Session) in TOM.NET. This is considered bad practice, for reasons I'm not going to dwelve into here.
By default, when attempting to create a new instance (e.g. Session session = new Session()), you get a run-time exception: The type initializer for 'Tridion.Localization.StringResourceManager' threw an exception. This can be fixed by referring to the Tridion.ContentManager.config file from your application's app.config, web.config, or DLL.config.
Make sure your config contains at least the following lines:
By default, when attempting to create a new instance (e.g. Session session = new Session()), you get a run-time exception: The type initializer for 'Tridion.Localization.StringResourceManager' threw an exception. This can be fixed by referring to the Tridion.ContentManager.config file from your application's app.config, web.config, or DLL.config.
Make sure your config contains at least the following lines:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="tridionConfigSections" type="Tridion.Configuration.ConfigurationSections,
Tridion.Common, Version=3.0.0.211, Culture=neutral,
PublicKeyToken=349a39f202fa9b53" />
</configSections>
<tridionConfigSections>
<sections>
<clear />
<add filePath="C:\Program Files
(x86)\Tridion\config\Tridion.ContentManager.config" />
</sections>
</tridionConfigSections>
<startup>
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
In my case C:\Program Files (x86)\Tridion is my %TRIDION_HOME%. Make sure you use the correct path on your system.
Comments