DANIEL VAUGHAN

App.config Type String Verification With Msbuild

19 Oct 2009

Nicolas Dorier and I have posted a new article on verifying type string names in app.config files using MSBuild.

The App.Config Type verifier is a custom MSBuild task. It examines your app.config file at compile time and verifies that string type names are resolvable.

To demonstrate, let’s take a look at a simple example. The following is an excerpt from an app.config file.

<configuration>
	<configSections>
		<section name="name1" type="Foo.BahType, Foo"/>
	</configSections>
</configuration>

Here we have a section defined that refers to a type called BahType in assembly Foo. At compile time, the AppConfigVerifier will attempt to resolve the type BahType. If the type is unresolvable a build error will ensue.

Error List

Figure Build error from missing assembly.

We are able to control how types are resolved. In a later section we will see how we can use XML comments to exclude and include type and assembly names.

Read on…