update System.Web.WebPages dll - c#

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.

Related

ECS1705 which has a higher version than referenced assembly

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/

Generate Objective-C Framework from .NET Standard Project using Embeddinator 4000 on Windows

I have a current Xcode iPhone project that I would like to switch over to Xamarin so that I can support iOS and Android with a single code base. However, in the short term I don't have the time to replace the Xcode project with a Xamarin forms version. Therefore, I have come up with a plan to build the core logic into a Xamarin solution in VS20017. I would then use Embeddinator-4000 to generate a .framework file which I could use from my Xcode project. In this way I can maintain the current Xcode UI project while I work on a full Xamarin replacement.
I was hoping to develop on a Windows machine, as this is what I'm most used to, but I can't seem to get embeddinator to work.
I've tried to get it to work with a Xamarin.iOS project, .NET Standard 2.0 and .NET Framework 4.6.2. Each fails with a dependency error, given below:
Xamarin - Can't find the assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e', referenced by 'Embed.Xamarin, Version=1.0.7015.35480, Culture=neutral, PublicKeyToken=null'
.NET Standard - Can't find the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51', referenced by 'Embed.Standard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
.NET Framework - Can't find the assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', referenced by 'Embed.NetFX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Embedded.NetFX
I have two questions
Am I using a workable approach to migrate my Xcode project over to Xamarin or is there some other option, of which, I'm not aware of? Maybe a conversion tool?
If this approach is workable, what do I need to do to get Embeddinator to work on a windows machine? Is it even possible?

Runtime Loading Azure.Search.Common.5.0.2 fails to load Microsoft.Rest.ClientRuntime

I am trying to load the dll for Microsoft.Azure.Search.Common.5.0.2 at runtime. From what I see on the nuget page, and from what nuget downloads when installing this, it depends upon Microsoft.Rest.ClientRuntime.2.3.12 . However, when I directly try to load the Azure.Search.Common dll using the following:-
Assembly.LoadFrom(dllPath).GetTypes().Select(t => t.Namespace).Distinct().ToList<string>();
I get the following Loader Exception:-
{"Could not load file or assembly 'Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
I am loading the dll after installing from nuget. Specifically, I am the loading the following dll:
Microsoft.Azure.Search.Common\Microsoft.Azure.Search.Common.5.0.2\lib\net452\Microsoft.Azure.Search.Common.dll
Just to be sure, I have also gone though my csproj and config files, to check for some version redirection, but that doesn't seem to be the case.
Context: I want to know all possible namespaces that a project might be using, hence I am downloading and loading all nuget packages to get their namespaces, amongst other things.
EDIT:
I tried to further analyse the dll by loading it into ILSpy. On loading the dll, ILSpy also shows that it refers to version 2.0.0.0 of Microsoft.Rest.ClientRuntime. It also fails to load that references and gives the following errors:-
// Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Assembly reference loading information:
// There were some problems during assembly reference load, see below for more information!
// Error: Could not find reference: Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// System.Net.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a (unresolved) // Newtonsoft.Json,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
(unresolved) // Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly
reference loading information: // There were some problems during
assembly reference load, see below for more information! // Error:
Could not find reference: Microsoft.Rest.ClientRuntime.Azure,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
By the way the following worked:
var ldAssmbly = Assembly.LoadFrom("Microsoft.Azure.Search.Common.dll");
var results = ldAssmbly.GetTypes().Select(t => t.Namespace).Distinct().ToList<string>();
The Trick is to copy all the dependencies to the output folder (like I did). Microsoft kindly built the Assembly Loader in a Cool way where it can scan for dependencies in the current path. Take advantage of that :)
It does depend on v2.0.0.0 - below is from IL manifest
Can you check your App.config - Whether a assembly redirect is added when you Install the nuget package? That may be the reason it doesnt work when you Reflection Load the Assembly.
Update:-
Yeah - Seems Dodgy:-
after nuget install - it does say the dependency is v2.3.12
However, the added dll shows v2.0.0 in VisualStudio.
dll file properties says v2.3.12 (which comes from AssemblyInfo version attribute)
But upon IL inspection - its clearly v2.0.0 (which is what VisualStudio shows)

Visual Studio Team Services Build Error on "System.Web.http" version

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.

How to set up project of htmlHelpers so that it produces two dlls - for mvc3 and mvc4?

I have a library of html helpers as a separate project. Right now it references system.web.mvc of version 4.
If I try to use this library in a project that uses mvc3 it throws an error when a helper is attempted to be used:
Compiler Error Message: CS1705: Assembly 'MyHtmlHelpers, Version=3.7.4.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
I understand that I need to build my helpers project with system.web.mvc of version 3 referenced in order for it to be compatible with mvc3 project. I do not want to have two projects with the same code with just the difference of system.web.mvc referenced.
Question is in the title.
Any help is appreciated.
I do not want to have two projects with the same code with just the
difference of system.web.mvc referenced.
You don't necessarily need to physically duplicate the source code. You could just have another .csproj for your class library which will add the source code as Linked Files and only replace the version of the System.Web.Mvc reference in the .csproj.
Take a look at how standard projects such as JSON.NET have their source code organized. They support multiple versions of .NET from 2.0 up to 4.0 and yet the source code is the same. It's the project files that are doing the job.

Categories

Resources