How to fix “Unresolved assembly reference not allowed: System.Web.Mvc” with ILMerge

You can find this problem while you are merging your project using ILMerge and you can see that System.Web.Mvc is not in your Visual Studio installation.

This dependency belongs to ASP.NET MVC 3, a Microsoft’s framework used for building web applications. Normally these dependencies and others of this framework are not included on Visual Studio installation. In my experience, they are not included in Visual Studio 2013 Express.

You need only download this framework from http://www.asp.net/mvc/mvc3 (direct link overhere http://www.microsoft.com/en-us/download/details.aspx?id=1491) and then you can now find the dll (System.Web.Mvc.dll) in this folder in a default installation:

1
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies

Thus, you can find others dlls of this framework like (System.Web.WebPages.dll, System.Web.WebPages.Razor.dll, Microsoft.Web.Infrastructure.dll, etc) in this folder:

1
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies

Add the dll to the ILMerge command parameters or add the library folder:

1
/lib:"c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies" /lib:"C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblie"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>