Reputation: 432
One of my project solution is working fine on a system where I have installed VS 2013. But When I open the same project on another system in VS 2015 it is giving this reference error:
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'D:\src\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.dll' and 'C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.IO.dll'. Remove one of the duplicate references.
The project file is referencing the package file, but when it opens in VS it auto converts to Framework library path. I can't uninstall the BCL package because it is a dependency for other packages.
Why does the solution build fine in one version of Visual Studio but it gives the multiple assemblies error in another version?
Is there a way to resolve this issue so that it works in different versions?
I also have this issue however his solution builds perfectly in VS 2017 but it cannot build on VS 2015.
Upvotes: 8
Views: 4473
Reputation: 7465
If you are using a common assembly across multiple projects and want to ensure they are using the same version, I recommend installing that version into the Global Assembly Cache.
Then that version from the GAC will be available from the references dialog.
Use that same dialog for the references across assemblies.
Upvotes: 1
Reputation:
This error occurs when a non-portable library references to a portable library then the build system adds a
facade
assemblies. [1]
Try to remove following references:
<Reference Include="System.IO">
<HintPath>..\packages\System.IO.4.0.10-beta-22516\lib\net45\System.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System.Text.Encoding">
<HintPath>..\packages\System.Text.Encoding.4.0.10-beta-22516\lib\net45\System.Text.Encoding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\packages\System.Threading.Tasks.4.0.10-beta-22516\lib\net45\System.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
Upvotes: 1
Reputation: 39082
This error usually appears when a NuGet package has invalid dependencies, but this is not the case as everything works well in other versions of Visual Studio.
First you can force reinstall all NuGet packages. That can be done by opening the Package Manager Console
and typing:
Update-Package -reinstall
Second most common solution to this problem is to ensure Visual Studio is updated to the latest version (Visual Studio 2015 Update 3 in this case). If that doesn't help, please try reinstalling Visual Studio completely on that device. Finally - you can try to install Visual Studio 2015 on another PC to verify if this is actually a problem of that version, or a PC-specific issue.
Upvotes: 1