No way to resolve conflict between "XYZ" and XYZ" - c#

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 :)

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.

Error CS0433 in Xamarin Forms Project

I'm absolutely desperate with this.
I wanted to change my Xamarin Forms Project from PLC to .NET Standard (v.1.5) and i made the mistake to change it in the Project options. After changing, i realised it's a bad approach and wanted to restore to PLC. After changing back i cannot build the project anymore as I'm getting 96 compile errors. Every error is saying "Error CS0344"
The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
and 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
It says that for basically every CS and XAML file i have in the project. I have no idea what to do to fix this. I searched almost the whole web for a solution and i'm clueless.
Thanks in regards for your help.

Could not load file or assembly 'Microsoft.Practices.ObjectBuilder2, Version=2.2.0.0, Culture=neutral

My application is running fine on local, after i publish to azure web apps it gives me the error
Could not load file or assembly 'Microsoft.Practices.ObjectBuilder2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
how do I fix this? I do not even have the objectBuilder2, if its something I have to reference where do I get it?Please help
Microsoft.Practices.ObjectBuilder2 is part of Enterprise Library. See here
Do you use this library? If not, try to remove references to it. If you use it, then add appropriate .dll to your installation.
For me Microsoft.Practices.Unity references was broken. I've just removed and added it again and worked. Maybe any refereces to Microsoft.Practices.* that would be broken can show this error.
Place Microsoft.Practices.ObjectBuilder2.dll in bin folder of your web application, this will work.

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?

C# Could not load file or assembly Interop.InetCtlsObjects

I've upgraded a VB6 project to C# and I'm trying to run a winforms project and I have the Interop.InetCtlsObjects.dll file in my project and I've added a reference to it, but when I'm trying to run it I'm getting this error:
Could not load file or assembly
'Interop.InetCtlsObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies.
The system cannot find the file specified.
But I can see the file and I added a reference to it's exect location...
So what am I missing here ???
Delete the reference, save the project and add it in again. It is possible that you are somehow referencing a different version and the compiler cannot find the right DLL because of it. If that doesn't work, check your app.config and make sure the versions for this particular DLL match.

Categories

Resources