title: WebActivatorEx.dll (Unity bootstrap) is firing on a different project
body: <p>I have 3/4 projects all using their own Unity, with a bootstrap.cs file, these are from the Unity Mvc5 nuget package.</p>
  
  <p>When I start project 1, namespace (MvcAdmin)
  it is firing the bootstrap for project 2 (namespace MvcApi), which is causing an exception!</p>
  
  <p>I've checked and confirmed it's not caused by iis routes or anything. Also checked, all WebActivatorEx's are using different namespaces etc.</p>
  
  <p>This class below is what is firing, but it shouldn't be:</p>
  
  <pre><code>[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(MvcApi.App_Start.UnityWebApiActivator), "Start")]
  
  namespace MvcApi.App_Start
  {
      /// &lt;summary&gt;Provides the bootstrapping for integrating Unity with WebApi when it is hosted in ASP.NET&lt;/summary&gt;
      public static class UnityWebApiActivator
      {
          /// &lt;summary&gt;Integrates Unity when the application starts.&lt;/summary&gt;
          public static void Start() 
          {
              // Use UnityHierarchicalDependencyResolver if you want to use a new child container for each IHttpController resolution.
              // var resolver = new UnityHierarchicalDependencyResolver(UnityConfig.GetConfiguredContainer());
  
              var container = UnityConfig.GetConfiguredContainer();
              DepResolver.SetResolver(new DepResolver(container));
              DepResolver.ExceptionHelper().OnAppInit();
  
              var resolver = new UnityDependencyResolver(UnityConfig.GetConfiguredContainer());
              GlobalConfiguration.Configuration.DependencyResolver = resolver;
  
          }
      }
  }
  </code></pre>
  
  <p>Why could this be happening?</p>
  
  <p>Here's my callstack:</p>
  
  <pre><code>MvcShared.dll!MvcShared.Helpers.AppSettingsHelper.throwExceptionIfCountIncorrect(int count) Line 129    C#
      MvcShared.dll!MvcShared.Helpers.AppSettingsHelper.GetAppSettingsFromDb() Line 109 + 0x3c bytes  C#
      MvcShared.dll!MvcShared.Helpers.AppSettingsHelper.ReadXmlAndStoreSettings() Line 48 + 0xa bytes C#
  &gt;   MvcApi.dll!MvcApi.App_Start.UnityConfig.RegisterTypes(Microsoft.Practices.Unity.IUnityContainer container) + 0x774 bytes    
      MvcApi.dll!MvcApi.App_Start.UnityConfig..cctor.AnonymousMethod__0() + 0x65 bytes    
      mscorlib.dll!System.Lazy&lt;Microsoft.Practices.Unity.IUnityContainer&gt;.CreateValue() + 0x1c7 bytes 
      mscorlib.dll!System.Lazy&lt;Microsoft.Practices.Unity.IUnityContainer&gt;.LazyInitValue() + 0x1dc bytes   
      MvcApi.dll!MvcApi.App_Start.UnityConfig.GetConfiguredContainer() + 0x47 bytes   
      MvcApi.dll!MvcApi.App_Start.UnityWebApiActivator.Start() + 0x28 bytes   
      [Native to Managed Transition]  
      WebActivatorEx.dll!WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() + 0x155 bytes    
      WebActivatorEx.dll!WebActivatorEx.ActivationManager.RunActivationMethods&lt;WebActivatorEx.PreApplicationStartMethodAttribute&gt;(bool designerMode) + 0x356 bytes    
      WebActivatorEx.dll!WebActivatorEx.ActivationManager.RunPreStartMethods(bool designerMode) + 0x2f bytes  
      WebActivatorEx.dll!WebActivatorEx.ActivationManager.Run() + 0xbd bytes  
      [Native to Managed Transition]  
      System.Web.dll!System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(System.Collections.Generic.ICollection&lt;System.Reflection.MethodInfo&gt; methods, System.Func&lt;System.IDisposable&gt; setHostingEnvironmentCultures) + 0x1a5 bytes 
      System.Web.dll!System.Web.Compilation.BuildManager.InvokePreStartInitMethods(System.Collections.Generic.ICollection&lt;System.Reflection.MethodInfo&gt; methods) + 0x67 bytes 
      System.Web.dll!System.Web.Compilation.BuildManager.CallPreStartInitMethods(string preStartInitListPath) + 0xf0 bytes    
      System.Web.dll!System.Web.Compilation.BuildManager.ExecutePreAppStart() + 0x98 bytes    
      System.Web.dll!System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager appManager, System.Web.Hosting.IApplicationHost appHost, System.Web.Configuration.IConfigMapPathFactory configMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters hostingParameters, System.Security.Policy.PolicyLevel policyLevel, System.Exception appDomainCreationException) + 0x47f bytes   
      System.Web.dll!System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager appManager, System.Web.Hosting.IApplicationHost appHost, System.Web.Configuration.IConfigMapPathFactory configMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters hostingParameters, System.Security.Policy.PolicyLevel policyLevel) + 0x26 bytes 
      [Appdomain Transition]  
      System.Web.dll!System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(string appId, System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x147d bytes 
      System.Web.dll!System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(string appId, System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x35 bytes    
      System.Web.dll!System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(string appId, System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x92 bytes  
      System.Web.dll!System.Web.Hosting.ApplicationManager.CreateObjectInternal(string appId, System.Type type, System.Web.Hosting.IApplicationHost appHost, bool failIfExists, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x6f bytes   
      System.Web.dll!System.Web.Hosting.ProcessHost.StartApplication(string appId, string appPath, out object runtimeInterface) + 0x1fb bytes 
  </code></pre>