C# MVC Build warning for Microsoft.AspNet.Scaffolding.12.0 - c#

I have a C# MVC project, it was working last week but when I started working again this week I am getting this warning and all the adjustment or changes I am making in the controllers doesn't reflect:
Could not resolve this reference. Could not locate the assembly "Microsoft.AspNet.Scaffolding.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxx, processorArchitecture=x86". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Hope someone can help me.
Thanks!
EDIT
I'm seeing this on my references, so what I did is I deleted it then added it again now there's a different warning, please see below.
New Warning:
The primary reference "Microsoft.AspNet.Scaffolding.12.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2".

Related

What might be causing apparent nuget package self-references?

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.

ASP.NET Warning - CS1701: Assuming assembly reference

Recently we've started upgrading all our projects to MVC5. I've done 4 other projects without issue but for some reason this one is throwing 95 warnings.
ASPNETCOMPILER : warning CS1701: Assuming assembly reference 'System.Web.Mvc,
Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' matches 'Sy
stem.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
', you may need to supply runtime policy
Now I am completely aware of what this warning normally means. I have looked EVERYWHERE for an incorrect reference, checked every single dependency, even gone so far as to grep every single file in my project folder. I feel like I've wasted days on this and its driving me bonkers!
Does anyone have any suggestions on debugging this issue?

Assembly conflict after upgrading package

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?

No way to resolve conflict between "XYZ" and XYZ"

We just did a merge(TFS) between two branches. But now when I compile, I've this error:
No way to resolve conflict between
"AA.BB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
and
"AA.BB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bfd296a93930d932".
Choosing "AA.BB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
"AA.BB" is one of our project, I've checked that we only reference it as a project. And we have only project named like this.
Does someone knows why this error is happening? And where this PublicKeyToken error can come from?
What I already tried:
Remove all reference to this project and make again the references
Search if one of those project was having a copyLocal = true(not the case) or referencing directly a DLL(not the case)
Note that:
The build is considered as succeed but when I launch the application I got errors(basically an error saying that this dll doesn't match the manifest)
If I got in the classes that uses this, I've no errors
I finally found the issue, I post it since maybe it can help someone in the future.
The issue was that before the Merge, there were some project which were having a different output directory.
So, when doing the rebuild, some project were finding multiple reference of the same project in different directory.
The solution is quite simple: Delete manually once the output directory and you're good :)

build error 'Cannot resolve dependency to assembly '

I'm amateur in c#, I learned basics and start programming, I try to download open source projects from svn of sf.net but in compile of most of them I faced with an error like this:
build error, 'Cannot resolve dependency to assembly '
and in continue of error it give a publicKeyToken and no line give me.
What is wrong? I just open project with Visual studio .net 2010 and try to debug. please help me.
Seems that you have some assembly reference which may not exists or may have wrong details.
You need to either correct the details in the web.config or you need to install assembly reference to your c drive
Cannot resolve dependency to assembly 'System.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' because it has not been preloaded.
When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on >demand through the ReflectionOnlyAssemblyResolve event.
To resolve it you can just switch off in VisualStudio: Debug->Exceptions->System.IO

Categories

Resources