Question

Microsoft's documentation on the type attribute of section element of the .NET configuration file says:

type="Fully qualified class name, assembly file name, version, culture, public key token"

which is what's usually called the assembly-qualified class-name, but in the example further down the same page the value is merely the fully-qualified class-name (ie. it doesn't specify the assembly):

<configuration>
   <configSections>
      <section name="sampleSection"
               type="System.Configuration.SingleTagSectionHandler" />
   </configSections>

So my question is:

Does the type attribute have to be an assembly-qualified class-name, or is it sufficient to set it to the fully-qualified class-name?

The class I'm referencing is in the System.Configuration.dll.

I'm hoping I don't have to specify the assembly of the class because then I have to specify the version number, which I don't know at build-time. I'm therefore hoping that the documentation is incorrect and that it's safe to merely specify the fully-qualified class-name. My tests indicate that the fully-qualified class-name is sufficient, but I'm reluctant to release this into production without being sure that it's allowed.

Was it helpful?

Solution

You will need to specify the assembly name if the class does not reside in the current assembly. The version and public key information may be neccessary if you use strong names.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top