I'm not able to build the solution in Visual Studio 2013.
This just happened after I updated my JSON.NET package to 6.0.1. Before that, it was working like a charm.
Any ideas?
PS: It's probably something about OWIN. It references JSON.NET too I think, maybe dynamically?
Full error
Error 11 The type 'Newtonsoft.Json.Linq.JObject' exists in both
'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll' and
'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
C:\Users\Me\Desktop\Solutions\[Project]\TrendPin\App_Start\Startup.Auth.cs 48 21 [Project]
I have this in my Web.Config
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
I have this in my .csproj
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Build Output
1>------ Build started: Project: [Project].Backend, Configuration: Debug Any CPU ------
1> All packages listed in packages.config are already installed.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3277: 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.
1> [Project].Backend -> C:\Users\Me\Desktop\Solutions\[Project]\[Project].Backend\bin\Debug\[Project].Backend.dll
2>------ Build started: Project: [Project].Data, Configuration: Debug Any CPU ------
2> All packages listed in packages.config are already installed.
2> [Project].Data -> C:\Users\Me\Desktop\Solutions\[Project]\[Project].Data\bin\Debug\[Project].Data.dll
3>------ Build started: Project: [Project], Configuration: Debug Any CPU ------
3> All packages listed in packages.config are already installed.
3>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3243: No way to resolve conflict between "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
3> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "4.5.0.0" [C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll] to Version "6.0.0.0" [C:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
3>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly></assemblyBinding>
3>C:\Users\Me\Desktop\Solutions\[Project]\[Project]\App_Start\Startup.Auth.cs(48,21,48,28): error CS0433: The type 'Newtonsoft.Json.Linq.JObject' exists in both 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll' and 'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
4>------ Skipped Build: Project: [Project].Tests, Configuration: Debug Any CPU ------
4>Project not selected to build for this solution configuration
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
In your csproj file you will notice that there are 2 entries for Newtonsoft.Json. Remove the following entry:
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
You can reflect owin and see what is it looking for in references. If it looks for specific version, you in trouble but if not, just put the version you want into application bin together with owin and hope that the signatures match. Also remember, there is GAC. So, you have room for experimentation
I had almost the same issue after doing a merge. Turns out the merge left two references to Newtonsoft.Json in the csproj file. There was on DLL in the project and only one version in the NuGet package manager, but the csproj referenced Newtonsoft.Jason 5.0.6 and 5.0.8
I edited the csproj in notepad++ and removed the offending reference, et voila. It solved the build errors
Related
I have an assembly with TargetFrameworkVersion v4.7.1 that has a reference to Autofac.Integration.WebApi.Owin 5.0.0.
During compile, I get a warning saying
warning MSB3277: Found conflicts between different versions of "System.Net.Http" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
Running my application on a server that has only .NET Framework 4.7.1 installed, I get the following runtime exception
System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Owin.AutofacWebApiAppBuilderExtensions.UseAutofacWebApi(IAppBuilder app, HttpConfiguration configuration)
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\xx\yyServer\yyServer.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/xx/yy/Server/
LOG: Initial PrivatePath = NULL
Calling assembly : Autofac.Integration.WebApi.Owin, Version=5.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da.
From dotPeek, I can see the following information about the assemblies
Autofac.Integration.WebApi, 5.0.0.0, msil, .Net Framework v4.6.1, Debug
References:
- System.Net.Http (4.2.0.0)
Autofac.Integration.WebApi.Owin, 5.0.0.0, msil, .Net Framework v4.6.1, Debug
References:
- System.Net.Http (4.2.0.0)
My.Assembly, 1.0.0.0, msil, .Net Framework v4.7.1, Debug
References:
- System.Net.Http (4.0.0.0)
If I create a new and empty project targeting .NET Framework v.4.6.1-4.7.1, the System.Net.Http reference claims Version is 4.0.0.0. If I bump the project up to 4.7.1, the System.Net.Http reference says 4.2.0.0. Looking at nuget packages for System.Net.Http, there is no version 4.2.0. Using .NET Framework 4.7.2 for the actual project might work, but I'm not in a position to update to a new TargetFramework at the moment.
Adding the following assembly redirect to the app.config appears to fix this particular issue at runtime, however I'm not sure how happy I am with redirecting framework assemblies, and what other consequences that might bring. The compile time warning is still present.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
Why is the Autofac assembiles referencing version 4.2.0? Is there an issue with the package? Are there better ways to fix this rather than using an assembly redirect?
Taking Autofac out of it for a minute, if you do a search on system.net.http 4.2.0.0 you'll find that this is a problem with a lot of packages, from DocumentDb to System.Collections.Immutable. It apparently stems from a tooling issue where an assembly was built using VS 2017 (which is where System.Net.Http 4.2.0.0 comes from) and at build time that version was there, yet at runtime the project was not built with the same toolset and the assembly goes missing.
As you found, the short-term workaround is the assembly binding redirect.
For the longer term workaround, the Autofac package needs an update. I've filed an issue on your behalf.
I know this kind of question has been asked before:e.g. Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
But none of the answers to that question solved my problem. I've actually had similar issues with Google packages in the past.
My full exception message is:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Google.Cloud.BigQuery.V2, Version=1.2.0.0, Culture=neutral, PublicKeyToken=185c282632e132a0' or one of its dependencies. The system cannot find the file specified.'
I've tried re-installing the NuGet package.
I've tried adding the dependency to my app.config:
<dependentAssembly>
<assemblyIdentity name="Google.Cloud.BigQuery.V2" publicKeyToken="185c282632e132a0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
I've tried cleaning and rebuilding the solution.
My Nuget manager screen:
The DLLs are in the bin/Debug and bin/Release folders:
I actually just noticed that I have 1.4 installed and it's saying 1.2 is missing, so why is it looking for 1.2? If I downgrade the BigQuery.v2 package to 1.2 my project runs, but why is 1.4 saying that the 1.2 file is missing?
I tried to include chart to my xamarin forms app using Microchart and when in install the Microchart and Microchart.forms nuggets i cant build my project again it give the the following error
Severity Code Description Project File Line Suppression State
Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.ValueTuple.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute() Xceed365m4.Droid C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1410
00
I have System.ValueTuple, Version=4.4 installed. Please how can i fix this?
I guess you are using .net framework version 4.7.This is a bug,for more info refere,https://github.com/dotnet/standard/issues/476.
A workaround is to use a binding redirect in app.config.
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.4.0.0"/>
</dependentAssembly>
If not try to add the reference manually from your solution.
Download System.ValueTuple manually from nuget and refer to this dll from your solution.
Right click on the References folder -> Add Reference -> Browse Location -> Add it.
Clean and build.
I'm working on Windows with Xamarin.Forms netstandard2.0 and I had some error like that after adding a project reference.
The solution for me was... adding the reference "System.Configuration.dll" (..Windows\Microsoft.NET\Framework64\v4.0.30319\System.Configuration.dll) to the .Net Standard project.
I had a similar error, and it turned out I had some zombie build processes running on my machine. There were three MSBuild.exe's running without Visual Studio open. Killed them manually and the error went away.
After much search the solution for me was to update my .Net framework on my system
I fixed by adding below line in web config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
..........
<runtime>
...........
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</runtime>
I'm publishing a WPF app using Visual Studio 2015. After the publish, when I click the .application file, it throws this error:
Unable to install or run the application. The application requires that assembly System.Windows.Interactivity Version 4.5.0.0 be installed in the global assembly cache (GAC) first.
The version of System.Windows.Interactivity in my app is 4.0.0.0. So why would it be asking for 4.5.0.0? I can't even find that version on the web.
Based on this question, I updated my app.config to have this, to no avail:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
In the Error List tab of Visual Studio, it has the following warning:
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.
What am I doing wrong? Thanks.
Apparently, MVVM Light Toolkit installs a 4.5 version of System.Windows.Interactivity in the project, and that was conflicting with the 4.0 version. Solution:
Expand project references.
Locate System.Windows.Interactivity.
Right-click it and choose Remove.
Right-click References and choose Add Reference.
Under Assemblies > Extensions, check the box for System.Windows.Interactivity version 4.5.0.0.
Click OK to close the references.
Now publish again and the installer works fine. As part of the above research into what was causing the conflict, I enabled diagnostic output for the build, which generated a verbose log. On about line 2,000, it included this:
Unified Dependency "System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". (TaskId:13)
1> Using this version instead of original version "4.0.0.0" in "C:\Users\myUserName\Documents\Visual Studio 2015\Projects\MyProject\packages\Blend.Interctivity.WPF.v4.0.1.0.3\lib\net40\Microsoft.Expression.Interactions.dll" because of a binding redirect entry in the file "App.config". (TaskId:13)
1> Resolved file path is "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45\System.Windows.Interactivity.dll". (TaskId:13)
1> Reference found at search path location "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45". (TaskId:13)
1> For SearchPath "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45". (TaskId:13)
1> Considered "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45\System.Windows.Interactivity.winmd", but it didn't exist. (TaskId:13)
1> Required by "GalaSoft.MvvmLight.Platform, Version=5.2.0.37226, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL". (TaskId:13)
1> Required by "Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". (TaskId:13)
1> This reference is not "CopyLocal" because it conflicted with another reference with the same name and lost the conflict. (TaskId:13)
1> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:13)
Seems like I get this weird problem while running Xamarin.iOS on Visual studio.
This happened after I updated to the latest Xamarin (today).
I have connected to my Mac though. I tried to Google it, no answer...
"error MSB4057: The target "GetBuiltProjectOutputRecursive" does not exist in the project"
What is the problem? Before the update, it worked!
1>------ Build started: Project: GTS.Mobile.iOS, Configuration: Debug iPhoneSimulator ------
1> Generated session id: 04dbf5285bd918e0f3e1fc41e6f65f8c
1> Generated build app name: GTSMobileiOS
1> Connecting to Mac server 192.168.9.164...
1>C:\Users\kkh\Computas\CargoNet\GTS.Mobile\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets(243,5): warning : All projects referencing GTS.Mobile.csproj must install nuget package Microsoft.Bcl.Build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317569.
1> Consider app.config remapping of assembly "System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.11.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Runtime.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.IO, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.11.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.IO.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [C:\Users\kkh\Computas\CargoNet\GTS.Mobile\GTS.Mobile\GTS.Mobile\bin\Debug\System.Net.Http.dll] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Threading.Tasks, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.11.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Threading.Tasks.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
1> GTS.Mobile.iOS -> C:\Users\kkh\Computas\CargoNet\GTS.Mobile\GTS.Mobile.iOS\bin\iPhoneSimulator\Debug\GTSMobileiOS.exe
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.After.targets(59,36): error MSB4057: The target "GetBuiltProjectOutputRecursive" does not exist in the project.
I have solved the problem on my own installation.
Here is what i did:
Install the newest xamarin on both visual studio and mac.
Install xamarin studio (newest)
Remove all xamarin products including gtk.
Install xamarin newest(complete pack) with the installer
Reboot computer
Open solution and clean/build