title: Could not load file or assembly Hunspellx64.dll while using NHUnspell NuGet package?
body: <p>I have an ASP.NET/MVC Web Role that is using the NHUnspell NuGet package.  When I try to run it I get the following error message:</p>
  
  <pre><code>Could not load file or assembly 'Hunspellx64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
  </code></pre>
  
  <p>This is strange because I as far as I know, my Web Role project should not be trying to load the unmanaged Hunspellx64.dll at all.  That should be handled by the managed NHUnspell DLL.  That DLL is copied over to the /bin directory of the Web Role as a build step.</p>
  
  <p><strong>UPDATE:</strong>  Thanks to Thomas's comment about WebActivator being outdated I was able to fix the issue.  I am duplicating my reply comment to his accepted answer to make sure others who have this problem see the fix:</p>
  
  <blockquote>
    <p>I had NHUnspell working successfully before this error started
    occurring.  What broke things was installing AttributeRouting with
    NuGet.  AttributeRouting drags in an old version of WebActivator
    (1.0.0.0).  Unfortunately NuGet does not suggest an update to it when
    you execute an Update operation.  You have to manually do the update
    via the Package Manager Console as per this web page's instructions:</p>
    
    <p><a href="http://www.nuget.org/packages/WebActivator" rel="nofollow">http://www.nuget.org/packages/WebActivator</a></p>
  </blockquote>
  
  <p><strong>Here is the rest of the original post before the fix was received:</strong></p>
  
  <p>I have scoured my project for direct references/linkages to Hunspellx64.dll including my NuGet packages configuration, packages.config, web.config, my References list, the raw Project File, etc.  I can't find any direct reference to that DLL.  Where else can I look or what else can I try to stop my project from trying to load that unmanaged DLL directly?  Here is the ASP.NET error dump:</p>
  
  <pre><code>[BadImageFormatException: Could not load file or assembly 'Hunspellx64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.]
     System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
     System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
     System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
     System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark&amp; stackMark) +102
     System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
     WebActivator.PreApplicationStartCode.Start() in D:\Code\Bitbucket\WebActivator\WebActivator\PreApplicationStartCode.cs:11
  
  [InvalidOperationException: The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Hunspellx64.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
     System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
     System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
     System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
     System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
     System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
  
  [HttpException (0x80004005): The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Hunspellx64.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874568
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
  </code></pre>