Could not load type "Namespace.Class" from assembly "Namespace"

This article has been moved to its new home here: https://benperk.github.io/msdn/2013/2013-12-could-not-load-type-namespace-class-from-assembly-namespace.html

I have been working hard learning the new features of ASP.NET 4.5, specifically using the following methods:

  • HttpResponse.BeginFlush
  • HttpResponse.EndFlush
  • Stream.ReadAsync
  • HttpRequest.GetBufferedInputStream
  • HttpRequest.GetBefferlessInputStream
  • Stream.BeginRead
  • Stream.EndRead

All of which need to be implemented using either a handler or module, if you want to use them in IIS.  Can’t say that I did this a lot in the past, but this error took me a lot of time to resolve and searching for a solution was equally time consuming.  Therefore, it is worthy of this blog.

The default properties for a class in Visual Studio 2012 are shown in Figure 1.

Figure 1, default class properties

After configuring the module in my web.config file, when I ran the ASP.NET 4.5 web site, the following as shown in Figure 2 was rendered.

Figure 2, Could not load type ‘Namespace.Class’ from assembly ‘Namespace’

The solution was to change the Build Action property from Content to Compile.  And bingo, the error went away.

Figure 3, Solution: change Build Action from Content to Compile