I am upgrading dnn5 to dnn7, and there is one dll System.Web.Razor which is giving runtime error.
System.IO.FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=2.0.20126.16343, 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)
File name: 'System.Web.Razor, Version=2.0.20126.16343, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=1.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)
File name: 'System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\dev.booking
LOG: DisplayName = System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///E:/Projects/www/dnn7_dev/
LOG: Initial PrivatePath = E:\Projects\www\dnn7_dev\bin
Calling assembly : RazorEngine, Version=3.0.8.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Projects\www\dnn7_dev\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.0.0 redirected to 2.0.20126.16343.
LOG: Post-policy reference: System.Web.Razor, Version=2.0.20126.16343, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80131040.
at RazorEngine.Compilation.DefaultCompilerServiceFactory.CreateCompilerService(Language language)
at RazorEngine.Templating.TemplateService.CreateTemplateType(String razorTemplate, Type modelType)
at RazorEngine.Templating.TemplateService.CreateTemplate(String razorTemplate, Type templateType, Object model)
at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
at RazorEngine.Razor.Parse[T](String razorTemplate, T model)
at XPL.Common.Templating.TemplateProcessor.ProcessProducts(String template, List`1 products, TemplateBaseData templateBaseData)
I searched in all places, c# forum etc but could not find solution.
I did following but didn't work (web.config):
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.20126.16343" />
</dependentAssembly>
I also tried re-building dll after "Specific version" true once then false other time. Both not working. It's frustating