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>
Related
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.
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>
I installed the Breeze Sharp client, but get the following warning.
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="System.Net.Http.Primitives" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.2.13.0" newVersion="4.2.13.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
Please try using the latest Breeze.Sharp Nuget ( 0.5.9.0 or greater) and let me know if you still have issues.
Should this...
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
...become this?
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
Or should I leave it alone?
What about when I update Razor from 3.0 to 3.1?
Should this...
<add key="webpages:Version" value="3.0.0.0" />
...become this?
<add key="webpages:Version" value="3.1.0.0" />
Or should I leave it alone?
What about when I go from 5.1.1 and 3.1.1 respectively? Should I be as granular as possible in my web.configs, or leave them at their major revisions? It seems to work both ways!
Late add:
And what the heck is going on here?
It says 5.1.1 in the path to the assembly, but 5.1.0.0 in the Version. Which number should I be using in the Web.config?
Yes to MVC, no to WebPages. WebPages assembly version did not change, it was only a NuGet package version upgrade.
On Web.config always use the assembly version, not the package version. I don't think they'll use the patch part on the assembly version, only on the package version.
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!