2015-11-04 2 views
2

J'ai créé la bibliothèque de classes portable "Contracts" ciblant .net 4.6, ASP.NET Core et Windows 10. Cette bibliothèque contient uniquement des classes POCO .Causes de la bibliothèque portable: Conflits trouvés entre les différentes versions du même assembly dépendant qui n'ont pas pu être résolus

J'ai un autre projet intitulé "Communications" visant .net 4.6 et le référencement de la bibliothèque portable:

enter image description here

Lorsque je tente de construire le projet, je reçois avertissement:

Description: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.  
Project:  Communication 
File:  C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets 
Line   1819 

le journal de construction détaillée est ici: buildlog.txt

Pourquoi je reçois t son avertissement? Comment s'en débarrasser?

ici sont des pièces du journal de construction qui peuvent être pertinents:

1> Unified Dependency "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". 
1>  Using this version instead of original version "1.5.0.0" in "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll" because AutoUnify is 'true'. 
1>  Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Net.Http.dll". 
1>  Reference found at search path location "{TargetFrameworkDirectory}". 
1>   For SearchPath "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib". 
1>   Considered "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.winmd", but it didn't exist. 
1>   Considered "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.dll", but it didn't exist. 
1>   Considered "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.exe", but it didn't exist. 
1>   For SearchPath "{TargetFrameworkDirectory}". 
1>   Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Net.Http.winmd", but it didn't exist. 
1>  Required by "System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". 
1>  Required by "System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 
1>  This reference is not "CopyLocal" because it conflicted with another reference with the same name and lost the conflict. 
1>  The ImageRuntimeVersion for this reference is "v4.0.30319". 

...

1> Dependency "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". 
1>  Could not resolve this reference. Could not locate the assembly "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 
1>   For SearchPath "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib". 
1>   Considered "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Core.winmd", but it didn't exist. 
1>   Considered "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Core.dll", but it didn't exist. 
etc... 
1>   For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.6,AssemblyFoldersEx}". 
1>   Considered AssemblyFoldersEx locations. 
1>   For SearchPath "{AssemblyFolders}". 
1>   Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Core.winmd", but it didn't exist. 
1>   Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Core.dll", but it didn't exist. 
etc... 
1>   For SearchPath "{GAC}". 
1>   Considered "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes", which was not found in the GAC. 
1>   For SearchPath "bin\Debug\". 
1>   Considered "bin\Debug\System.Core.winmd", but it didn't exist. 
1>   Considered "bin\Debug\System.Core.dll", but it didn't exist. 
1>   Considered "bin\Debug\System.Core.exe", but it didn't exist. 
1>  Required by "System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 

...

1> There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". 
1>  "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not. 
1>  References which depend on "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll]. 
1>   C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll 
1>   Project file item includes which caused reference "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll". 
1>    System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL 
1>    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll 
1>    Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL 
1>   C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Formatting.dll 
1>   Project file item includes which caused reference "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Formatting.dll". 
1>    System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL 
1>   C:\Projects\MySolution\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 
1>   Project file item includes which caused reference "C:\Projects\MySolution\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll". 
1>    System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL 
1>    Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL 
1>  References which depend on "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" []. 
1>   C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll 
1>   Project file item includes which caused reference "C:\Projects\MySolution\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll". 
1>    System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL 

Répondre

1

J'ai package mis à jour NuGet système .Net.Http dans mon projet .net 4.6 et l'avertissement a disparu. Généralement, il est assez difficile de trouver la racine de ce genre de problèmes. .NET distribué via nugget va être en désordre à l'avenir.