Error when upgrading glass mapper - asp.net-mvc

Currently i have glass mapper v3 and in process of upgrading to latest glass mapper i.e. v4, however when i build the project its giving me following error.
Severity Code Description Project File Line Suppression State
Error CS1705 Assembly 'Glass.Mapper.Sc.Mvc' with identity 'Glass.Mapper.Sc.Mvc, Version=4.2.1.188, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc' with identity 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Here is the table of support versions of MVC with Sitemap versions. 8.1 and 8.2 support 5.2 MVC.
https://kb.sitecore.net/articles/087164
The latest glass mapper may not work with the older versions of Sitecore.
You can upgrade your MVC to 5.2 and add bindings to your web.config to make requests to 5.1 work on 5.2.
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>

Related

How do I get rid of these remapping warnings in a brand new MVC project after updating all nuget packages?

I've seen a million questions about this but it all seems a little different, I do apologize if this is a dupe though.
I've created a brand new MVC project. I've stripped out a bunch of Nuget packages I'm not using (bundling/optimization, jQuery, bootstrap, etc.).
When I build I get this:
1> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "4.5.0.0" [] to Version "9.0.0.0" [...\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Antlr3.Runtime, Culture=neutral, PublicKeyToken=eb42632606e9261f" from Version "3.4.1.9004" [] to Version "3.5.0.2" [...\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll] to solve conflict and get rid of warning.
I also get the following in VS error list view:
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Antlr3.Runtime" culture="neutral" publicKeyToken="eb42632606e9261f" /><bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /></dependentAssembly></assemblyBinding>
I went ahead and double clicked that entry but it does nothing and the error is dismissed (no file content changes). When I build again I get the same warnings again each time.
This is the contents of my <runtime> object in my Web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
What am I missing?
NOTE: I'm using Visual Studio 2015 Pro. This is a standard ASP.Net 4.5 MVC template project, not .Net Core.
EDIT: Forgot to mention the Solution Nuget manager "Consolidate" tab is empty for me.

Microsoft.Data.OData Version mismatch for Breeze Server - for Web API 2

Breeze Server - for Web API 2 version 1.4.8 in Nuget installs Microsoft.Data.OData Version=5.6.1, yet references version 5.6.0.
See error below:
Metadata query failed for: *; Could not load file or assembly 'Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Make sure you correct the correct assembly versioning (web.config if a web project) as:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
</dependentAssembly>
</assemblyBinding>
Then in your Data project's app.config file, comment out the <entityFramework> section:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
Then, if you don't already have it, add the following config section:
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
Lastly, in your XxDbContext class, add/modify your static constructor as:
static XxDbContext()
{
var type1 = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
}
These steps fixed my issue.
Good luck.
[Symptom]
If you started having this issue without introducing new dependencies, it is likely that your temporary asp.net folder has lost integrity.
[Solution]
Try deleting %LOCALAPPDATA%\Temp\Temporary ASP.NET Files\

Is there any free version for Telerik ASP.NET MVC 4?

I'm going to develop ASP.NET MVC 4 using VS2012.I heard that Telerik released some free version for Telerik MVC 4.I search everywhere but i couldn't find out.Anyone had a experience on it ?
There isn't a version of Telerik Extensions for ASP.NET MVC 4. However you can use the ASP.NET MVC 3 version without any problems. You need to add the following binding redirects to your web.config:
<configuration>
<!--... elements deleted for clarity ...-->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Razor intellisense not working with custom ASP.NET MVC build

I was able to create a custom build of ASP.NET MVC and use it in a web application, however, I can't seem to figure out how to get the Razor intellisense to work correctly.
If you follow the steps below, the Razor intellisense will only show WebPages info and nothing else (HTML helpers etc.).
I'm using VS 2012.
Here's what I've done so far:
I cloned the latest ASP.NET Web Stack
Opened the Runtime.sln and built the solution
Created a new ASP.NET MVC 4 (.NET 4.0) web application
Deleted existing references for System.Web.Mvc, System.Web.Razor, System.Web.WebPages, System.Web.WebPages.Razor, System.Web.WebPages.Deployment and added references to the built assemblies in step #2.
In ~/Views/Web.config, replaced System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 with just System.Web.WebPages.Razor
Also, replaced System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 with just System.Web.Mvc
Removed the following from the web.config
<runtime>
<assemblyBinding xmlns="urn:schemasmicrosoftcom:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
If you're looking for intellisense support in VS 2012 for views, as well as the right-click context menus for the controllers folder and views folder (shortcuts to add controller and add view) then you need to open up the .csproj file of your web project and manually edit it to include the MVC project type GUID. This is what VS actually uses to decide what flavor of intellisense you get (among other things).
Specifically, the xml tag of the .csproj file you're looking for is:
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
You should be missing the GUID value
{E3E379DF-F4C6-4180-9B81-6769533ABE47}
Good luck!

Why is Combres still looking for an older version of System.Web.Mvc?

I'm using Combres with my MVC 3 RC project and getting an an assembly binding error when I deploy it to my web server.
System.IO.FileLoadException
Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
<%= Html.CombresLink("commonJs") %>
My development machine has the MVC 1 and 2 assemblies in the GAC, so it works fine there. The web server doesn't have any version of MVC in the GAC, and I'm bin-deploying the MVC 3 assembly. My project references version 3.0.0.0 of System.Web.Mvc, and I have the following section in my web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly xmlns="">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I thought that this section would tell Combres to use version 3.0.0.0 instead. Why is my application failing to resolve the reference?
I don't think the binding redirect will chain - you have a reference to 1.0 somewhere, and your config tells it to load 2.0, which does not exist.
You need just one binding redirect with oldVersion set to "1.0.0.0-2.0.0.0"

Resources