Last post Aug 06, 2010 07:45 AM by bradwils
Aug 06, 2010 05:12 AM|crowleywilson|LINK
If I use the webforms view engine with MVC3, using an import directive on a strongly typed view causes a compile time error.
e.g, given the fully qualified model class ImportBug.Models.TestModel,
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TestModel>" %>
<%@ Import namespace="ImportBug.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Causes the following:
Compiler Error Message: CS1061: 'object' does not contain a definition for
'Name' and no extension method 'Name' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Aug 06, 2010 07:45 AM|bradwils|LINK
Yep, that's a bug we know about. Work around for right now is to make sure the @Page directive is the last pre-processor directive in your file. Will be fixed in Preview 2.