'Sitecore Razor Intellisense - Preventing publish
I am starting to learn Sitecore development at the moment and after setting up my solution and noticed that Intellisense is not picking up Sitecore related classes.
I have also already added Sitecore.Mvc.dll and Sitecore.Kernel.dll into my references folder.
I tried creating new projects with the same steps for both VS 2015/2017 to no avail.
On publish, these will turn into errors and hence solution will not be published.
Solution 1:[1]
It seems there is a version conflict between System.Web.Mvc 5.1.0.0 and System.Web.Mvc 5.2.3.0. The last one is used in Sitecore 8.1 and later.
You should either align the version referenced in your code with the required one or configure the assembly bindings:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Solution 2:[2]
The fix apparently was to upgrade to .NET Framework 4.6. My Sitecore instance was Sitecore version 8.2.
My initial .NET framework was 4.5.2 which was actually also compatible with Sitecore 8.2, however I had no idea why it suddenly worked when I upgraded the .NET Framework to 4.6. I re-tried it on 2 projects and had same behavior.
Below is a screenshot from the Sitecore site showing the compatibility of Sitecore 8.2 with ASP.NET framework version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Serhii Shushliapin |
| Solution 2 | thebernardlim |

