Skip to end of metadata
Go to start of metadata

Duplicate Imports

If you see "duplicate import" issues, you may see error messages like the following:

FreeForm refers to both N2.Templates.Mvc.Models.Parts.FreeForm, N2.Templates.Mvc, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null and Dinamico.Models.FreeForm, MWMvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (try using auto-import="false")

Solution: Check your ~/bin/ directory and ensure that you don't have both N2.Templates.Mvc and Dinamico templates in the same project. You can't use both traditional MVC and Dinamico (Razor MVC) templates in the same project.

Assembly binding issues

Errors such as [FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=5.1.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)]

This is typically caused by errors in your web.config file. Ensure that the XML tags are matched properly. Pay particular attention to the <assemblyBinding> section. 

For example the following configuration is NOT correct because there are two <dependentAssembly> tags in a row.

Example. Incorrect assembly binding

Incorrect web.config XML
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
	<assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181" culture="neutral" />
	<bindingRedirect oldVersion="0.0.0.0-2.9.4.1" newVersion="2.9.4.1" />
</dependentAssembly>
<dependentAssembly>
	<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
	<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<dependentAssembly>
	<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
	<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
	<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
	<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
	<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
	<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
	<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
	<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>