Unable to find reference to assembly in a Visual Studio website - asp.net

I have a legacy WebSite project (as opposed to a Web Application project). It was using .net 3.5 but I am updating it to 4.0.
Due to the compilation error ...
Compiler Error Message: CS1705: Assembly 'System.Web.Mvc, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.WebPages,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has
a higher version than referenced assembly 'System.Web.WebPages,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
... I added a reference to the newer version of System.Web.WebPages. This added the following line to the web.config file:
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
However, when I try to build the website I get this error:
The type 'System.Web.WebPages.WebPage' exists in both
c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll'
and 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll'
I cannot seem to find a reference anywhere in the project to the v4.0 1 version of WebPages. I assume this means that some other assembly is probably referring to it but I'm not sure where to go from here.
Any idea how to track down what is referring to the assembly and either remove the reference or update the calling the assembly?

Related

Assembly uses 'System.Runtime' Version=4.2.2.0 which has a higher version than referenced assembly 'System.Runtime' Version=4.1.2.0

I have a .NET Framework 4.7.2 project that reference a .NET Core 3.1 library. The problem is that I get this error:
Error CS1705 Assembly 'X' with identity 'X, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
In NuGet Manager for both projects, I have tried to add System.Runtime 4.3.1. Still I get the same error. How can this be fixed?

Warning MSB3277: Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved

I have been dragging around this build warning for quite some time and I would like to get rid of it when building my Xamarin.Forms.Ios project.
I get the warning
"/Applications/Visual
Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(5,5):
Warning MSB3277: Found conflicts between different versions of
"Microsoft.CSharp" that could not be resolved. These reference
conflicts are listed in the build log when log verbosity is set to
detailed. (MSB3277) (BB.App.iOS)"
In the build log I find the following statement.
There was a conflict between "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
"Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
References which depend on "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll].
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll
Project file item includes which caused reference "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll".
Microsoft.CSharp
References which depend on "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
/Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll
Project file item includes which caused reference "/Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll".
/Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll
/Users/sjorsmiltenburg/_Sources_BookaBooka/BB.App/BB.App/bin/Debug/netstandard2.0/BB.App.dll
I could find a similar issue on android but here the cause is related to newtonsoft.json having a reference to the old CSharp.dll.
What I read here is that Automapper is referencing Microsoft.CSharp 4.7 (which I can find in the nuget references of my main project), but I Can't figure out where the Microsoft.CSharp 2.0.5.0 reference comes from.
I can drill down the nuget - reference tree in my main project but not in my XF.ios project. In my ios.proj file i find no reference to CSharp.dll

Could not load assembly System.Runtime in Xamarin.Forms UWP Project with .NET Standard library

I'm in the process of setting up a Xamarin.Forms app using .NET Standard for the shared library instead of a PCL. I've followed the instructions for doing so laid out here: https://channel9.msdn.com/Shows/XamarinShow/Snack-Pack-15-Upgrading-to-XamarinForms-to-NET-Standard
This is with a brand new Xamarin.Forms app, created using Visual Studio 2017 with a PCL, which was replaced with a .NET Standard library as described in the video.
The UWP app compiles fine, but throws this exception when I try to start it (on the call to Xamarin.Forms.Forms.Init)
System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
I've tried specifically adding the nuget package for System.Runtime, version 4.1.0 to the UWP project, but that doesn't seem to help. It runs fine in Android, but keeps giving me this exception running the UWP project. Can anyone tell me what might be causing this and how I can fix it?
edit:
there is a very similar error in the build log:
Could not resolve this reference. Could not locate the assembly "System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Followed by an extremely long list of places it has checked.
I also found this, which seems like it may be the problem:
2> There was a conflict between "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
2> "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
Does anyone know how I can resolve this conflict?
edit 2:
There's also this in the build logs right after the above, which is even more perplexing, as it seems to indicate the only thing referencing version 4.0.20.0 of System.Runtime is... version 4.3.0 of System.Runtime???
2> References which depend on "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\Katie.nuget\packages\system.runtime\4.3.0\ref\netcore50\System.Runtime.dll].
2> C:\Users\Katie.nuget\packages\system.runtime\4.3.0\ref\netcore50\System.Runtime.dll
2> Project file item includes which caused reference "C:\Users\Katie.nuget\packages\system.runtime\4.3.0\ref\netcore50\System.Runtime.dll".
2> C:\Users\Katie.nuget\packages\system.runtime\4.3.0\ref\netcore50\System.Runtime.dll

higher version than referenced assembly

Im getting this error:
Error 101 Assembly 'EPiServer.Web.WebControls, Version=6.1.379.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' uses 'EPiServer, Version=6.1.379.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' which has a higher version than referenced assembly 'EPiServer, Version=5.2.375.236, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' c:\EPiServer\Sites\suntliv 6.2\bin\EPiServer.Web.WebControls.dll SuntLiv.Web
Does it mean that the assembly EPiServer.Web.WebControls calls for EPiServer DLL version 6.1.379.0 but only finds EpiServer DLL version 5.2.375.236?
The first comment says it all. It was not properly referenced.

Assembly version mismatch with system.web.mvc, syncFusion

I am trying to execute a sample provided by Syncfusion and I get an assembly error.
(0): error CS1705: Assembly 'Syncfusion.Schedule.Mvc, Version=10.104.0.44, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' uses 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
I thought I just had to remove the failing reference and add my higher version, number 4. Unfortunatly, on the build, the project keeps on trying to build with the version 2.
I should at least have this:
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
But on the build I get this:
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, ublicKeyToken=31BF3856AD364E35" />
Make sure that the project you are building is an ASP.NET MVC 3 project and not an ASP.NET MVC 2 project. Given this error, it looks like you are using SyncFusion components that are designed for MVC 3 only.
Please check the below,
If you are using Syncfusion samples, then we would suggest you to check the Configuration Manager. If you are using MVC-2 then please set Configuration Manager as debug and if you are using MVC-3 then please set Configuration Manager as debug-MVC3.
Note: Configuration Manager will be available in Build Menu
If you have created your own sample we would suggest you to check the dll reference in the project and run the MVC switcher and assembly manager. Please refer the below link.
http://help.syncfusion.com/resources/Content/ug_101/user%20interface/asp.net%20mvc/grid/documents/612howtoswitchbetwee.htm
Regards,
Sridhar N

Resources