3

I have enabled MvcBuildViews in my project.

It works completely fine when I build.

Then if I build again/change something and try to build again, it fails when it starts to compile the views with the error:

CS0103 The name 'model' does not exist in the current context It is pointing at the first cshtml file in obj\Release\AspnetCompileMerge\Source\bin\Views\Shared\EditorTemplates\DateRange.cshtml

Here's that file, not that it helps:

@model MyProject.Web.Extensions.DateRange
@using Abp.Web.Mvc.Extensions

<div class="input-daterange input-group">
<input type="text" class="input-sm form-control" name="startDate" id="startDate" required="required" />
<span class="input-group-addon">~</span>
<input type="text" class="input-sm form-control" name="endDate" id="endDate" required="required"/>

I absolutely have no idea why this is happening. The only way to get this working is to delete my obj folder and rebuild.

I want it to be smart and know what it does and doesn't need to rebuild (since it takes ages).

Here is my views/Web.Config:

    <?xml version="1.0"?>

    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" 
                      type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, 
                      System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
      </configSections>

      <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, 
              System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="myproject.Web.Views.myprojectWebViewPageBase">
          <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="myproject" />
            <add namespace="myproject.Web" />
            <add namespace="myproject.Editions" />
            <add namespace="myproject.Authorization" />
            <add namespace="myproject.Web.Extensions" />
            <add namespace="Abp.Web.Mvc.Extensions" />
            <add namespace="myproject.Web.Controllers" />
            <add namespace="myproject.Utilities.HtmlHelpers" />


          </namespaces>
        </pages>
      </system.web.webPages.razor>

      <appSettings>
        <add key="webpages:Enabled" value="false" />
      </appSettings>

      <system.webServer>
        <handlers>
          <remove name="BlockViewHandler"/>
          <!--<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />-->
        </handlers>
      </system.webServer>

    </configuration>

Here is my Web.Config

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=301880
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
        <section name="ActiveReports9" type="GrapeCity.ActiveReports.Web.ActiveReportsSettingsSection" />
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
        <sectionGroup name="elmah">
          <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
          <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
          <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
          <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
        </sectionGroup>
        <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
        <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
      </configSections>
      <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
      <!--
        For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

        The following attributes can be set on the <httpRuntime> tag.
          <system.Web>
            <httpRuntime targetFramework="4.6.1" />
          </system.Web>
      -->
      <system.web>
        <customErrors mode="On" defaultRedirect="Shared/Error.cshtml">
          <error statusCode="404" redirect="/" />
        </customErrors>
        <compilation targetFramework="4.6.1" debug="true">
          <assemblies>
            <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="GrapeCity.ActiveReports.Extensibility.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Diagnostics.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Chart.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Document.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Export.Html.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Export.Pdf.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Export.Image.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </assemblies>
        </compilation>
        <httpRuntime targetFramework="4.6.1" />
        <httpHandlers>
          <add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
          <add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
          <add verb="*" path="*.ar9" type="GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
          <add verb="*" path="*.ar9Web" type="GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
          <add verb="*" path="*.ActiveReport" type="GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
          <add verb="*" path="*.rpx" type="GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
          <add verb="*" path="*.rdl,*.rdlx" type="GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
          <add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
        </httpHandlers>
        <!-- Glimpse: This can be commented in to add additional data to the Trace tab when using WebForms
            <trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/> -->
        <httpModules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
          <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
          <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
        </httpModules>
      </system.web>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="EnvDTE" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
            <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="dotless.Core" publicKeyToken="96b446c9e63eae34" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.0" newVersion="1.5.2.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.AI.Agent.Intercept" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="2.0.5.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="EntityFramework.DynamicFilters" publicKeyToken="146423a1b8d60775" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.4.11.0" newVersion="1.4.11.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.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>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <publisherPolicy apply="no" />
            <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <system.webServer>
        <handlers>
          <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
          <add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" name="AsmxHandler" resourceType="Unspecified" preCondition="integratedMode" />
  <add verb="*" path="*.ar9" type="GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_ReportBinariesStreamer" resourceType="        Unspecified" preCondition="integratedMode" />
  <add verb="*" path="*.ar9Web" type="GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_WebCacheAccessHandler" resourceType="       Unspecified" preCondition="integratedMode" />
  <add verb="*" path="*.ActiveReport" type="GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_CompiledReportHandler" resourceType="       Unspecified" preCondition="integratedMode" />
  <add verb="*" path="*.rpx" type="GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_RpxHandler" resourceType="Unspecified" preCondition="       integratedMode" />
  <add verb="*" path="*.rdl,*.rdlx" type="GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.3.6979.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_RdlxHandler" resourceType="Unspecified"         preCondition="integratedMode" />
          <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
          <add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" />

        </handlers>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
          <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
          <remove name="ApplicationInsightsWebTracking" />
          <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
        </modules>
        <httpErrors errorMode="Custom">
          <remove statusCode="404" subStatusCode="-1" />
          <error statusCode="404" path="/" responseMode="ExecuteURL" />
        </httpErrors>
        <httpProtocol>
          <customHeaders>
            <clear />
            <add name="X-UA-Compatible" value="IE=EDGE" />
          </customHeaders>
        </httpProtocol>
      </system.webServer>
      <connectionStrings>
        <add name="myprojectContext" connectionString="<CONNECTIONSTRING>" providerName="Oracle.ManagedDataAccess.Client" />
      </connectionStrings>
      <dotless minifyCss="false" cache="true" web="false" strictMath="false" />
      <ActiveReports9>
        <WebService reportsFolder="~/" assemblyFolder="~/" accessPoint="/WebEdiARService.asmx" />
      </ActiveReports9>
      <elmah>
        <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/Log" />
        <!--
            See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for 
            more information on remote access and securing ELMAH.
        -->
        <security allowRemoteAccess="false" />
      </elmah>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
          <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </providers>
      </entityFramework>
      <location path="elmah.axd" inheritInChildApplications="false">
        <system.web>
          <httpHandlers>
            <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
          </httpHandlers>
          <!-- 
            See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for 
            more information on using ASP.NET authorization securing ELMAH.

          <authorization>
            <allow roles="admin" />
            <deny users="*" />  
          </authorization>
          -->
        </system.web>
      </location>
      <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
        <!-- 
              For more information on how to configure Glimpse, please visit http://getglimpse.com/Help/Configuration
              or access {your site}/Glimpse.axd for even more details and a Configuration Tool to support you. 
          -->
      </glimpse>
      <system.codedom>
        <compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"         warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral,         PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
        </compilers>
      </system.codedom>
      <system.data>
        <DbProviderFactories>
          <remove invariant="Oracle.ManagedDataAccess.Client" />
  <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0,         Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </DbProviderFactories>
      </system.data>
      <oracle.manageddataaccess.client>
        <version number="*">
          <dataSources>
            <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
          </dataSources>
        </version>
      </oracle.manageddataaccess.client>
    </configuration>
Worthy7
  • 1,455
  • 15
  • 28
  • psss, I have tried all of the checks of versions in my web.config file as suggested in other questions. This is something wacky since it always works the first time. – Worthy7 Feb 24 '17 at 09:34
  • Check System.Web.MVC.dll – Perdido Feb 24 '17 at 09:35
  • Check what about it exactly – Worthy7 Feb 24 '17 at 09:36
  • how your web.config in Views folder looks like, chances are it misses reference to the assembly – Ehsan Sajjad Feb 24 '17 at 09:40
  • see here : http://stackoverflow.com/questions/6389055/the-name-model-does-not-exist-in-current-context-in-mvc3 – Ehsan Sajjad Feb 24 '17 at 09:40
  • I read every answer there, please remember that it ALWAYS compiles the first time. – Worthy7 Feb 24 '17 at 10:10
  • Try cleaning and rebuilding the solution – bolt19 Feb 24 '17 at 10:14
  • Clean you mean like, to delete the obj folder and stuff – Worthy7 Feb 24 '17 at 10:27
  • If someone could explain in detail, or point me to an article somewhere which explains how the build process works when there are already some files in the `obj` folder, that would be a good start in the right direction. Especially regarding the `AspnetCompileMerge` folder – Worthy7 Feb 27 '17 at 00:21
  • @Worthy7, You are going to have to show more code. Show the view that the error message refers to. Create a new project from scratch and see if it works. Another option also is to launch VS as administrator. Could be a permissions issue. – Nkosi Feb 27 '17 at 01:11
  • 1) Ok Ill add more code, but really it doesn't matter what is in there as long as it seems to be ignoring the majority of razor syntax. This particular view is extremely simple. 2) I'm sure a project from scratch will work. 3) Already doing this as an Administrator (Visual Studio (Administrator)) – Worthy7 Feb 27 '17 at 02:07
  • Again please keep in mind that this always builds the FIRST TIME, and then after that, the AspnetCompileMerge folder exists. Until I delete that folder, the views will throw this error. So when it is doing a compile merge, is it using some different Web.Config or something? – Worthy7 Feb 27 '17 at 03:06
  • @Worthy7 do you think it has anything to do with your custom pageBaseType? – Nkosi Feb 27 '17 at 03:08
  • @Worthy7 Also any particular reason you remove `BlockViewHandler`? – Nkosi Feb 27 '17 at 03:12
  • Compare the Views/web.config of a fresh project to your Views/web.config current version. – Nkosi Feb 27 '17 at 03:15
  • @Worthy7 For the particular view in example the `@using` usually tends to come before `@model`. if using `@using` they should be at the top of the file. – Nkosi Feb 27 '17 at 03:19
  • @Worthy7 Is `MyProject` a place holder just for the question cause they are different cases in the view and the Web.config? I am goign under the assumption that name cases are case sensitive here. – Nkosi Feb 27 '17 at 03:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/136712/discussion-between-worthy7-and-nkosi). – Worthy7 Feb 27 '17 at 03:27
  • @Worthy7 I think this line is suspicious. You need to replace `` with this `` in `Views Web.config`. – Mairaj Ahmad Feb 27 '17 at 04:21
  • @Mairaj thanks but I'm using a custom base view on purpose – Worthy7 Feb 27 '17 at 07:20
  • Make sure you are running VS as an Administrator – GreatJobBob Mar 05 '17 at 14:28

2 Answers2

1

So, the ACTUAL problem was in my project file I had this:

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
  </Target>

Deleted it, and I could recompile no problem.

Worthy7
  • 1,455
  • 15
  • 28
0

Have you tried to relocate the obj folder outside from your solution? Maybe it helps.

Unload your asp.net mvc project in the solution explorer and edit the project file.

Look for BaseIntermediateOutputPath and IntermediateOutputPath entries in the csproj files, and modify them:

<BaseIntermediateOutputPath>D:\Temp\VS\Your project name\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
apr
  • 552
  • 3
  • 9
  • The obj folder was being created in the root of the Web project. This was a setting I had in the project config along with telling it to build the views. I deleted the line and it seems to be compiling fine now.. you pointed me in the right direction as well as the other answer. – Worthy7 Mar 06 '17 at 07:54