views:

11

answers:

1

I have the following in my app.config.

<configuration>
<configSections>
         <sectionGroup name="FooGroup">
              <section
                  name="Foo"
                  type="Bar.FooSection"
                  allowLocation="true"
                  allowDefinition="Everywhere"
          />
          </sectionGroup>
 </configSections>
 ....

Bar.FooSection is in another assembly however, so I get a TypeLoadException.

What do I have to do?

+1  A: 

My tentative guess would be that you need to specify the assembly as a part of the type attribute's value, ie. make the mentioned type fully qualified, i.e. something along the lines of:

TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly,
Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

(Example taken from MSDN.)

You can probably omit the Version, Culture, and PublicKeyToken, and just write:

... type="Foobar.FooSection, FooAssembly" ...
stakx
using typeof(TopNamespace.SubNameSpace.ContainingClass).AssemblyQualifiedName get's you all you need. Thank's stakx!
Martin