After fixing the controller not found exception following our client's recent upgrade to Web Forms for Marketers 8.1, all of our forms continued to throw an exception on load:

Compilation Error. CS0104: 'Constants' is an ambiguous reference between 'Sitecore.Forms.Mvc.Constants' and 'SitecoreDemo.Constants'.

Web Forms for Marketers installs several views and editor templates into your Sitecore installation at ~/Website/Views/Form that it uses to render those nice-looking Bootstrap forms. The following three views and editor templates have references to a static Constants class in the Sitecore.Forms.Mvc namespace:

  1. ~/Website/Views/Form/Index.cshtml
  2. ~/Website/Views/Form/EditorTemplates/DateField.cshtml
  3. ~/Website/Views/Form/EditorTemplates/FormViewModel.cshtml

In our project, we also have a static Constants class in the root of our namespace, SitecoreDemo.Constants, among other utility classes. To avoid putting @using SitecoreDemo at the top of all of our views or using the fully-qualified name every time we reference one of those classes, we added our root namespace, SitecoreDemo, to the <namespaces> node in the web.config in the root of our project's Views folder:

<configuration>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Configuration" />
        <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="Sitecore.Mvc" />
        <add namespace="Sitecore.Mvc.Extensions" />
        <add namespace="Sitecore.Mvc.Presentation" />
        <add namespace="SitecoreDemo" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

Unfortunately the Web Forms for Marketers views listed above all have a @using Sitecore.Forms.Mvc statement so that they don't have to fully qualify Sitecore.Forms.Mvc.Constants each time they reference the constants in their Views. This causes the compiler to get confused when a WFFM form is loaded--it's not sure whether to use Sitecore.Forms.Mvc.Constants or SitecoreDemo.Constants.

I have filed a bug report with Sitecore about this issue, but in the meantime I've found the easiest solution to this issue is to add the three offending WFFM views listed above into my Sitecore solution, remove the @using Sitecore.Forms.Mvc statements, and fully qualify their reference to Constants as Sitecore.Forms.Mvc.Constants. After this our WFFM views have started loading normally again.