locked
Compilation Error: An assembly with the same identity ... RRS feed

  • Question

  • Normal 0 false false false MicrosoftInternetExplorer4 st1\:*{behavior:url(#ieooui) } /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0pt 5.4pt 0pt 5.4pt; mso-para-margin:0pt; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

     (Ignore the above....)

    =========================================================================================================

    I am developing a Web Application that seems to be getting an unusual error every now and then after I click on Debug > Start without Debugging.  To make it even more difficult is the fact that its quite random and seems to be related to a Web Service that I added as a Web Reference to my project.

    The error shows up randomly and comes in two different forms.  One being a successful compile and then when the page is loading it throws the error and the other being when I try to compile.

    Some details about my entire Solution and this problem:

    -         I have three Projects total: two Class Library's and an ASP.NET Web Site Project.

    -         I have the Silverlight 1.0 DLL being included to my Application but I am building my Silverlight Plugin as version 2.0.  Also I am using Javascript instead of Managed Code given the Javascript code was developed before using Managed Code was an option.

    -         The two errors occur randomly and there are steps that I take to prevent them temporally.  Those steps are listed further below.

    -         I am using Visual Studio 2008 Standard Edition.

    -         I have a "Built-in" Web Service that is located inside of the ASP.NET Web Site but this does not seem to be a problem at all given that I have been using it for months before this error started occurring.

    -         I have a Web Reference that I add to connect to a Web Service and this is what seems to be causing the problem (if you look at the steps that I following to temporally deal with the problem you will see further as to what I am talking about).  This Web Service does not in any way use Silverlight.

    -         The error seems to imply that I am importing a DLL multiple times in different locations.  But if you look at the error message below there is no indication as to where specifically this is occurring.

     

    Here is the process that I take to temporally deal with this issue:
    1) Error occurs (either after compilation or during compilation of the Solution).
    2) Remove Web Service Reference from Property Pages > References.
    3) Comment out all code that uses the Web Service.
    4) Compile the site with no errors.
    5) Right click on Project and click on Add Web Reference.
    6) Add the Web Service and uncomment code.
    7) Compile Solution and everything works just fine.

     

    And inside of my Bin folder are the following DLL's:

    -         AjaxControlToolkit.dll (ASP.NET AJAX)

    -         System.dll (Version 1.1.20926.0)

    -         System.SilverLight.dll (Version 1.0.0.0)

    -         3 Custom Classes

     

    Also, I did a search in my Web.Config file and found the following matches for "PublicKeyToken=b77a5c561934e089" in several locations:
            <compilation>
                <assemblies>
                    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    </assemblies>
    </compilation>

                <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="WarnAsError" value="false"/></compiler>
                <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="OptionInfer" value="true"/>
                    <providerOption name="WarnAsError" value="false"/></compiler></compilers>

    Does anyone have any clue as to what the problem might be?

    Thanks

     

     

    Below is the error that shows up on the actual Page instead of in Visual Studio:

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1703: An assembly with the same identity 'System, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.

    Source Error:

    [No relevant source lines]

    Source File:    Line: 0

    Show Detailed Compiler Output:

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE> "C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\85e00e0a\00364eca_e7ffc701\System.SilverLight.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\13098440\028f8dec_8407c901\OnlineFileBrowserComponents.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\a4c58370\00ef8f4d_865cc701\AjaxControlToolkit.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\7dd543b3\00364eca_e7ffc701\System.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\49875d2c\d93b3cc6_5913c901\ActionControls.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\c8d9d1a6\005f60b0_e9fec801\TabStructure.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /out:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\App_WebReferences.ziw6exvq.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701 /warnaserror-  "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\App_WebReferences.ziw6exvq.0.cs" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\App_WebReferences.ziw6exvq.1.cs"

    Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8

    for Microsoft (R) .NET Framework version 3.5

    Copyright (C) Microsoft Corporation. All rights reserved.

    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\71acf46c\50e3d68a\assembly\dl3\7dd543b3\00364eca_e7ffc701\System.DLL: error CS1703: An assembly with the same identity 'System, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.

    c:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll: (Location of symbol related to previous error)

     

    This is the error that shows up in Visual Studio (Note that I am not deliberately Importing anything to make this happen):

    Error      1      An assembly with the same identity 'System, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.  

     

    And below is a warning that shows up when neither of the above mentioned errors occur:

    Warning    4    Assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\a546e81e\764458fe\assembly\dl3\91ff2876\00364eca_e7ffc701\System.SilverLight.DLL' references assembly 'System, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', which is ambiguous between 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\a546e81e\764458fe\assembly\dl3\724c5b51\00364eca_e7ffc701\System.DLL' (referenced by project 'vbc') and 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll' (referenced by project 'vbc'). 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\a546e81e\764458fe\assembly\dl3\724c5b51\00364eca_e7ffc701\System.DLL' will be used. If both assemblies are identical, change the references to the same location.    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tabbuilder\a546e81e\764458fe\assembly\dl3\91ff2876\00364eca_e7ffc701\System.SilverLight.DLL :    

    Monday, September 22, 2008 1:42 PM

Answers

  • Hello, something to try: Remove all references and then add the necessary references back (in both ASP.NET and Silverlight). Use "Add Service Reference" instead of "Add Web Reference".

    Wednesday, September 24, 2008 4:22 AM

All replies

  •  Anyone have any thoughts? 

    I know thats a lot of information so it basically comes down to the question as to whether or not Silverlight could be importing soemthing that would be interferring with the rest of the Project.  I didn't have this problem until I added a Web Reference to my ASP.NET Web Site Project and if I remove it everything works fine (consistently instead of randomly).

    Tuesday, September 23, 2008 11:14 AM
  • Hello, something to try: Remove all references and then add the necessary references back (in both ASP.NET and Silverlight). Use "Add Service Reference" instead of "Add Web Reference".

    Wednesday, September 24, 2008 4:22 AM
  •  I was seeing something similar except with the reference to the mscorlib. In my case I was building under a configuration that I created in Configuration Manager, but forgot to create for a project I had recently added. Seems to be a shure fire way to get an absolutely useless error message on your build server. 

    Tuesday, October 28, 2008 9:04 AM
  •  I too was seeing this error (VS2010B2, Silverlight 4).  I discovered a file in the web project ClientBin directory  called MyApp.zip as well as the MyApp.xap that I expected.  I deleted both files.  I then looked at the bin directory and besides the MyApp.Web.dll (and corresponding pdb) I had the offending DLL's (why they got copied there I don't know).  I deleted these.  Problem solved, but I haven't yet pinned down the root cause.

    Wednesday, December 2, 2009 5:30 PM