I have few projects in my solution referring Syste.Web.Http and Formatting binary. Things are fine few days back but last week my Team Services build started failing without any changed made on ref: and it gives me below error
Assembly 'Microsoft.CloudOA.Wizard' with identity 'Microsoft.CloudOA.Wizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http' with identity 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
However, the same project is building fine in locally. I tried looking into all projects and made sure none of my project is using 4.0.0. But no luck. Can some one please help me to get rid of this issue? Thanks in advance.
Make sure that you check all bin folders. I mean it can be changed in bin folder, but reference in project can be still to 4.0.0.0.
Try running "Update-package" command for all your projects from "VS\Tools\Nuget Package Manager\Package Manager Console" to update the referenced packages to the latest version.
Related
My project called 'Gui Tester' has a microsoft.windowsdesktop.App.WindowsForms framework version 6.0.0. In addition, it has a project reference to WinForms class called 'WinFormsLibrary3' which its framework version 6.0.9. This causes the error below. How do I make both versions the same in order to solve this issue? I was unable to find a way to remove/add/update a framework.
A link to a sample solution (\AssemblyError\GuiTester\GuiTester.sln) can be found here - https://1drv.ms/u/s!AuZvh6FckScbhMpi02_Dm-YCBE00ew?e=KKNyLi
Error CS1705 Assembly 'WinFormsLibrary3' with identity 'WinFormsLibrary3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' which has a higher version than referenced assembly 'System.Windows.Forms' with identity 'System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
There is no way your Gui tester project (version 6.0.0) can open your winFormsLibrary3 (version 6.0.9). Since the lower version does not recognize or support a higher version which it never designs for. What you can do is create a new solution of gui tester with a higher version and just copy all the files from the old gui tester into your new gui tester.
As I wrote in the comment, you can try downgrade your target framework, but some times it cause unexpected behaviour
https://ourtechroom.com/fix/how-to-downgrade-net-framework-version-in-visual-studio/
I have a project file targeting net 472. It depends on a bunch of libraries that are built against netstandard2. Some of those libraries depend upon the Microsoft.Extensions.Primitives library although (as far as I can tell) there is no directly dependency from the root project. When I build it, I see this warning...
Severity Code Description Project File Line Suppression State
Warning Found conflicts between different versions of "Microsoft.Extensions.Primitives" that could not be resolved.
There was a conflict between "Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.Primitives, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60".
"Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.Extensions.Primitives, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not.
References which depend on "Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll].
C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll
Project file item includes which caused reference "C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll".
C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll
References which depend on "Microsoft.Extensions.Primitives, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
C:\Users\neilm\.nuget\packages\lazycache\2.1.3\lib\netstandard2.0\LazyCache.dll
Project file item includes which caused reference "C:\Users\neilm\.nuget\packages\lazycache\2.1.3\lib\netstandard2.0\LazyCache.dll".
C:\Users\neilm\.nuget\packages\lazycache\2.1.3\lib\netstandard2.0\LazyCache.dll
D:\work\code\b6\Backend\CSharp\Libraries\Standard\TableAccess_std\bin\Debug\netstandard2.0\TableAccess_std.dll
D:\work\code\b6\Backend\CSharp\Libraries\Standard\CommsCode_std\bin\Debug\netstandard2.0\CommsCode_std.dll
D:\work\code\b6\Backend\CSharp\Libraries\Standard\Recognisers\bin\Debug\netstandard2.0\Recognisers.dll
The relevant section, elided for readability, is
References which depend on "Microsoft.Extensions.Primitives, Version=5.0.0.0,...
C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll
Project file item includes which caused reference...
C:\Users\neilm\.nuget\packages\microsoft.extensions.primitives\5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll
which seems to be describing a self-reference. Any idea how this might be occurring? I've tried nuking the package cache, as well as the bin and obj folders but can't seem to get rid of it. TIA.
Edit I should probably add this is just one of a number of System packages for which I am getting this warning. Others include:
System.Diagnostics.DiagnosticsSource
System.Memory.Data
Edit 2 In case it is relevant, the root project is an Azure Cloud Service "Classic" worker role built using the Azure SDK which is why (regrettably) I can't just target .Net5 to try and work around this.
Edit 3 The conflicts appear to be resolved when adding local dependencies at a matching version but I would still like to understand where the original conflict is coming from and what the warning is trying to tell me. I think it is implying that the 472 framework depends on a different version of those packages/dlls but if so it's unclear what the appropriate resolution should be.
I am refering a C# library project from my Azure Function (Service bus queue trigger). The library is referencing the Newtonsoft nuget version 10.0.1.
While running the function locally on my visual studio, it gives this error .
{"Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"}
I tried downgrading to version 10.0.0, but the issue is there.
I stumbled upon this issue link : https://github.com/Azure/azure-functions-vs-build-sdk/issues/107.
And tried downgrading to 9.0.1. But even then the error still occurs.
Note: The library project reference several other library projects which are also referencing Newtonsoft. I am keeping the same version of the nuget all the sub projects.
How to solve this issue?
Pointing all the Newtonsoft dlls in all the sub libraries to version to 9.0.1 solved the issue.
I have a OneClick program, Project A, that references class library project B. Project B had Json.net version 4.5.0.0 that was upgraded to 7.0.0.0. Upon building project A I get the error messages:
No way to resolve conflict between "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
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 "7.0.0.0" [[projectpath]\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,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.
I have cleaned every project in the solution and rebuilt them. I've closed/opened VS, recleaned, rebuilt, same thing. Manually deleted obj + bin folders, same thing.
I've changed the Settings/Publish/Application Files menu to every variation of inclusion/exclusion for json.net.
And finally, I've global searched in Sublime(VS doesn't pick up everything) for 4.5.0.0 and come up with virtually nothing except the json.net references in the manifest files project A creates. I can't seem to find a single lingering reference to the old library, yet it keeps ending up in the manifest upon building.
I've solved my problem by adding <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> in the .csproj's relevant <PropertyGroup>s, but I'm not sure why it works. Can anyone explain to me what's going on? Is this a bad way to solve this problem?
I got the error CS1705:
Assembly 'PagedList.Mvc, Version=4.3.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' with a higher number of version than assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35', wich is refferenced.
I want to update the System.Web.WebPages in order to get a correct reference of PagedList.MVC to System.Web.WebPages.
(as displayed in the following link at the bottom of the page:
http://msdn.microsoft.com/en-us/library/416tef0c.aspx )
Where I can find a download or something like that?
If you use MVC3 the better solution for you will be to download more earliest version of PagedList, because "System.Web.WebPages, Version=2.0.0.0" is used by MVC4. MVC3 will generate an error if you change Version=1.0.0.0 to Version=2.0.0.0.
The other solution is update your MVC3 project to MVC4. You may use autoupdate tool from Nuget or there are a big nomber of articles in web, how to do it by hand.