Reputation: 4109
So, this error appears when I try to get a Razor
view compiled.
The source is the Line 28 of the Web.config
file inside the Views
folder:
Line 26: using System.Web.Optimization;
Line 27: using System.Web.Routing;
Line 28: using RuleRegressionTesterLib; //here
Line 29: using RuleRegressionTesterWebSite;
Here are the References
:
Configuration Manager...
Here is the view
:
@using RuleRegressionTesterLib.Results
@model IEnumerable<ReportResult>
@{
ViewBag.Title = "Home Page";
}
Here is the Web.config
file inside the Views
folder (as recommended in this answer)
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="RuleRegressionTesterLib" />
<add namespace="RuleRegressionTesterWebSite" />
</namespaces>
</pages>
</system.web.webPages.razor>
Why is this happening?
Thank you
Upvotes: 1
Views: 3241
Reputation: 4109
I am not sure why, but I had to actually add the assembly to the Views/web.config
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="RuleRegressionTesterLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</assemblies>
</compilation>
</system.web>
Does anybody know why?
Upvotes: 1