title: RunTime Error: The Type X exists in both VersionOne.dll and VersionTwo.dll
body: <p>Our ASP.NET web application, which uses the Telerik RadGrid, 2.0.2.0, needs to be updated for Windows 7 compatibility. The issue is that the existing functionality to export an Excel file does not produce an Excel file that is compatible with Office 2007, which is part of our new Windows 7 set of common applications.</p>
  
  <p>The issue is with these lines of code:</p>
  
  <pre><code>ExportXLS.Telerik.WebControls.RadGrid RadGrid1 = new
         ExportXLS.Telerik.WebControls.RadGrid();
  RadGrid1.MasterTableView.ExportToExcel(TableName, true, false);
  </code></pre>
  
  <p>We discovered that there is another dll, RadGrid.Net2 version 4.5.0.0, which includes a “ExportToExcel2007” method that is not available in the 2.0 version of the dll. This method does produce a valid Excel file that can be opened with Excel 2007.</p>
  
  <pre><code>Telerik.WebControls.RadGrid RadGrid1 = new Telerik.WebControls.RadGrid();
  RadGrid1.MasterTableView.ExportToExcel2007(TableName, true, false);
  </code></pre>
  
  <p>The problem is that there appears to be drastic differences between the two dlls and switching over to use the new dll didn't look easy. Our intended solution was to reference both dlls in the application but use the newer one only in the screen that is having the problem with creating a 2007 compatible Excel file.</p>
  
  <p>Using the following article as a guide, </p>
  
  <p><a href="http://blogs.msdn.com/b/ansonh/archive/2006/09/28/extern-alias-walkthrough.aspx" rel="nofollow">http://blogs.msdn.com/b/ansonh/archive/2006/09/28/extern-alias-walkthrough.aspx</a></p>
  
  <p>we made the following small changes:</p>
  
  <ol>
  <li><p>Added a reference in the web project to "RadGrid.Net2.dll" and adjusted the alias property of this reference to "<strong>ExportXLS</strong>"</p></li>
  <li><p>Add this to the top of the ExportExcel.aspx.cs code-behind page:             </p>
  
  <p>extern alias <strong>ExportXLS</strong>;</p></li>
  <li><p>Then, instantiated a radgrid using the new dll by referring to the qualified reference of the radgrid.net2.dll:</p>
  
  <p><strong>ExportXLS</strong>.Telerik.WebControls.RadGrid RadGrid1 = new <strong>ExportXLS</strong>.Telerik.WebControls.RadGrid();</p></li>
  <li><p>Modified the ExportToExcel method to use the 2007 counterpart method:</p>
  
  <p>RadGrid1.MasterTableView.<strong>ExportToExcel2007</strong>(TableName, true, false);</p></li>
  </ol>
  
  <p>This solved the issue with the ExportExcel.aspx page and the screen now produces a Excel 2007 compatible Excel spreadsheet, however, we were surprised that this change broke other pages in the application that uses RadGrid. This is the error:</p>
  
  <pre><code>    c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\7ff38b9a\2680aee3\App_Web_systemmapsearch.ascx.a97e7c59.tlmhafnf.0.cs(251): error CS0433: 
  
  The type 'Telerik.WebControls.GridRowIndicatorColumn' 
  exists in both 
      'c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET 
      Files\root\7ff38b9a\2680aee3\assembly\dl3\cd8ec314\002177c0_d2e8cb01\RadGrid.DLL' 
  and 
      'c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\7ff38b9a\2680aee3\assembly\dl3\428a2b2d\002177c0_d2e8cb01\RadGrid.Net2.DLL'
  </code></pre>
  
  <p>My expectation was that the other web pages would continue to use the unqualified older 2.0.2.0 version of the RadGrid.dll and would continue to work, but this is not the case. </p>
  
  <p>Here is some of the code from the code behind of the user control, SystemMapSearch.ascx, that fails to load:</p>
  
  <pre><code>&lt;%@ Register TagPrefix="radG" Namespace="Telerik.WebControls" Assembly="RadGrid" %&gt;
  &lt;radg:radgrid id="RadGrid1" cssclass="RadGrid" runat="server" allowpaging="True" allowsorting="True" gridlines="none"
          pagesize="20" width="100%" borderwidth="0" AutoGenerateColumns="False"&gt;
  </code></pre>
  
  <p>I have tried to change the NameSpace directive to include the global namespace, but this results in an invalid reference:</p>
  
  <pre><code>&lt;%@ Register TagPrefix="radG" Namespace="global::Telerik.WebControls" Assembly="RadGrid" %&gt;
  </code></pre>
  
  <p>Why does changing the ExportExcel.aspx page break the other pages and what do I have to do to fix the issue?  </p>