摘要继承成员未实现

时间:2015-11-10 10:07:50

标签: c# asp.net-mvc razor

我在Visual Studio 2013中创建了一个新的MVC项目,在使用空模板(带模型)和使用布局页面(设置为空)创建视图后,我收到以下信息:

Razor Error

这会导致视图呈现错误。我试过在其他地方寻找解决方案无济于事。清洁/重建解决方案也无济于事。令人讨厌的是,它是在一个全新的项目中实现的。

关于如何修复的任何想法?

其他信息:

查看/ Web.config中

join staffVideoLink in Database.VideosLinkings on new {a = video.VideoID, b = VideoInType.Staff}
    equals new {a = staffVideoLink.VideoId, b = staffVideoLink.VideoInType} into
    staffVideoLinks
from svl in staffVideoLinks.DefaultIfEmpty()
join staff in Staff on svl.VideoInKeyId equals staff.StaffID into visibleStaff 

DownloadViewModel

<?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.0.0.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="WebShopPortal.Web" />
      </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>

_ViewStart.cshtml

    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Web.Mvc;

    namespace WebShopPortal.Web.ViewModels
    {
        public class DownloadViewModel
        {
            public string ProductId { get; set; }

            public string DisplayText { get; set; }

            public string DownloadUrl { get; set; }

            public string OptionalReturnText { get; set; }

            [Required(ErrorMessage = "Title is required")]
            public string Title { get; set; }

            [DisplayName("First Name")]
            [Required(ErrorMessage = "First name is required")]
            public string FirstName { get; set; }

            [DisplayName("Last Name")]
            [Required(ErrorMessage = "Last name is required")]
            public string LastName { get; set; }

            [DisplayName("Job Title")]
            public string JobTitle { get; set; }

            [DisplayName("Company Name")]
            [Required(ErrorMessage = "Company name is required")]
            public string CompanyName { get; set; }

            [DisplayName("Company Type")]
            public int CompanyTypeId { get; set; }

            [DisplayName("Address Line 1")]
            public string Address1 { get; set; }

            [DisplayName("Address Line 2")]
            public string Address2 { get; set; }

            [DisplayName("Address Line 3")]
            public string Address3 { get; set; }

            [DisplayName("Address Line 4")]
            public string Address4 { get; set; }

            [DisplayName("City/Town")]
            public string Town { get; set; }

            [DisplayName("State/County")]
            public string County { get; set; }

            [DisplayName("Zip/Postcode")]
            public string Postcode { get; set; }

            public string Country { get; set; }

            [DisplayName("Phone Number")]
            public string WorkTelephone { get; set; }

            [DisplayName("Fax")]
            public string WorkFax { get; set; }

            [DisplayName("Email Address")]
            [EmailAddress(ErrorMessage = "Invalid Email Address")]
            [Required(ErrorMessage = "Email address is required")]
            public string EmailAddress { get; set; }

            public bool DoNotNotify { get; set; }

            public string ReturnUrl { get; set; }

            //Dropdowns
            public IEnumerable<SelectListItem> TitleList { get; set; }
            public IEnumerable<SelectListItem> CompanyTypeList { get; set; }
            public IEnumerable<SelectListItem> CountryList { get; set; } 
        }
    }

我可以保证在_Layout页面上没有任何时髦的事情。

更新

简单地关闭并重新打开解决方案似乎会使错误消失。

页面也很好。在创建一个新项目后,我发生了奇怪的事。我将监视以确定将来是否会再次发生。

1 个答案:

答案 0 :(得分:6)

这是一个很长的镜头,但你可以尝试这个步骤:

  • 在解决方案上运行清理
  • 使用问题卸载项目
  • 删除Visual Studio旁边生成的 .user 文件 项目
  • 使用问题重新加载项目
  • 构建解决方案

取自thread,也许可以帮到你。值得一试。