2

We have a server with about 200 web sites that all run code from the same assemblies. So for efficiency the assemblies are registered in the gac with the version number 1.0.0.0 They want to do a development site where the code differs from what is in the gac. The solution is comprised of several projects, one being a web application and it references 3 other c# library projects. I've updated all 4 projects version from 1.0.0.0 to 1.0.0.1 and then pushed the new compiled files to a development folder on the same server as all the other sites. From what I was reading, this should force that development site to use the dlls in the local bin directory rather than what's in the gac due to the version increment. However, when I run this I get the error from my global.asax ...

The type 'CMIWeb.Global' is ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\CMIWeb\v4.0_1.0.0.0__671ea09b8c72436a\CMIWeb.dll' or from assembly 'D:\Inetpub\wwwroot\cmidev\bin\CMIWeb.DLL'. Please specify the assembly explicitly in the type name.

I'm not sure how to get around this.

edit: Here's the bindingRedirect addition to the web.config file

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

        <dependantAssembly name="CMIWeb" PublicKeyToken="671ea09b8c72436a" culture="en-us" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1" />

        <dependantAssembly name="CMIBLL" PublicKeyToken="16740601ec0c3aab" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1" />

        <dependantAssembly name="CMIData" PublicKeyToken="6016b538121b0f75" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1" />

        <dependantAssembly name="CMIObjects" PublicKeyToken="110dd5d29fab7114" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1" />

        <dependantAssembly name="CMISettings" PublicKeyToken="90ce34438590d2f3" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1" />

    </assemblyBinding>
</runtime>

When this didn't work I also tried adding the following, but it still complains with the same error.

<compilation debug="true" targetFramework="4.0">
      <assemblies>
          <add assembly="CMIBLL, Version=1.0.0.1, Culture=neutral, PublicKeyToken=16740601ec0c3aab" />
          <add assembly="CMIData, Version=1.0.0.1, Culture=neutral, PublicKeyToken=6016b538121b0f75" />
          <add assembly="CMIObjects, Version=1.0.0.1, Culture=neutral, PublicKeyToken=110dd5d29fab7114" />
          <add assembly="CMISettings, Version=1.0.0.1, Culture=neutral, PublicKeyToken=90ce34438590d2f3" />
          <add assembly="CMIWeb, Version=1.0.0.1, Culture=neutral, PublicKeyToken=671ea09b8c72436a" />
      </assemblies>
  </compilation>
geoff swartz
  • 5,437
  • 11
  • 51
  • 75
  • Take a look here: http://stackoverflow.com/questions/5975171/gac-assembly-version-to-use-based-on-web-config?rq=1 – Brendan Hannemann Apr 03 '13 at 20:41
  • I tried to do the bindingRedirect as shown in the answer but I'm still getting the same error message. Here's part of what I have - – geoff swartz Apr 03 '13 at 20:52
  • Can you edit your question and put the full piece from the config? – Brendan Hannemann Apr 03 '13 at 21:02
  • Question has been edited with config code. – geoff swartz Apr 04 '13 at 13:27
  • Thanks. In your .aspx/ascx do you have any `<%@ Register assembly %>` commands? I wonder if the type definitions there are not specific enough. – Brendan Hannemann Apr 04 '13 at 15:23
  • No, it's complaining about this line on my global.asax page - <%@ Application Codebehind="Global.asax.cs" Inherits="CMIWeb.Global" Language="C#" %> – geoff swartz Apr 04 '13 at 16:54
  • I'm still puzzled. Did you try all the suggestions outlined here? Maybe that `` answer? http://stackoverflow.com/questions/981142/dll-in-both-the-bin-and-the-gac-which-one-gets-used – Brendan Hannemann Apr 04 '13 at 18:34
  • I've tried the codebase answer, and I tried also unsigning my dlls. No matter what I do the error message stays the same. Ugghhh... – geoff swartz Apr 04 '13 at 19:52
  • What about putting the full assembly information in the markup (Global.asax in this case)? Like http://stackoverflow.com/a/5032839/151234 ? – Brendan Hannemann Apr 04 '13 at 20:04
  • Ok, I gave that a try and now get this error - Could not load the assembly 'CMIWeb, version=1.0.0.1, culture=neutral, publickeytoken=671ea09b8c72436a'. Make sure that it is compiled before accessing the page. Here's the inherits - Inherits="CMIWeb.Global, CMIWeb, version=1.0.0.1, culture=neutral, publickeytoken=671ea09b8c72436a" – geoff swartz Apr 04 '13 at 20:10
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/27587/discussion-between-unicron-and-geoff-swartz) – Brendan Hannemann Apr 04 '13 at 20:14
  • Problem solved. We just turned one of the 3 servers into a dev server for the time being. Thanks unicron for the help! – geoff swartz Apr 05 '13 at 18:16

0 Answers0