dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.89k stars 4.01k forks source link

Scripting causes “multiple assemblies with equivalent identity have been imported” error #7686

Open annexus opened 8 years ago

annexus commented 8 years ago

When I add the package Microsoft.CodeAnalysis.Scripting to my project.json then I get the following errors:

Severity    Code    Description Project File    Line
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Runtime.Extensions.dll' and 'C:\Users\user-a\.dnx\packages\System.Runtime.Extensions\4.0.10\ref\dotnet\System.Runtime.Extensions.dll'. Remove one of the duplicate references.    WebApplication1     1
Error   CS0433  The type 'GuidAttribute' exists in both 'System.Runtime.InteropServices, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'  WebApplication1.DNX 4.5.1   C:\temp\vs2015\WebApplication1\src\WebApplication1\Properties\AssemblyInfo.cs   23
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Threading.Tasks.dll' and 'C:\Users\user-a\.dnx\packages\System.Threading.Tasks\4.0.10\ref\dotnet\System.Threading.Tasks.dll'. Remove one of the duplicate references. WebApplication1     1
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.IO.dll' and 'C:\Users\user-a\.dnx\packages\System.IO\4.0.10\ref\dotnet\System.IO.dll'. Remove one of the duplicate references.    WebApplication1     1
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Threading.dll' and 'C:\Users\user-a\.dnx\packages\System.Threading\4.0.10\ref\dotnet\System.Threading.dll'. Remove one of the duplicate references.   WebApplication1     1
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Globalization.dll' and 'C:\Users\user-a\.dnx\packages\System.Globalization\4.0.10\ref\dotnet\System.Globalization.dll'. Remove one of the duplicate references.   WebApplication1     1
Error   CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Diagnostics.Debug.dll' and 'C:\Users\user-a\.dnx\packages\System.Diagnostics.Debug\4.0.10\ref\dotnet\System.Diagnostics.Debug.dll'. Remove one of the duplicate references.   WebApplication1     1

My dependencies in project.json look like this;

  "dependencies": {
    "ClassLibrary1": "",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "System.Reflection": "4.1.0-beta-23516",
    "System.Runtime": "4.0.21-beta-23516",
    "System.Collections": "4.0.11-beta-23516",
    "Microsoft.CodeAnalysis.Scripting": "1.1.0"
  },

As soon as I remove Microsoft.CodeAnalysis.Scripting then everything builds fine.

Is this a bug or can I solve this issue somehow?

tmat commented 7 years ago

@annexus Is this still a problem with the latest package (v2.*)?