这在生产和测试系统上均失败,但在dev系统上运行良好。感觉有些东西在部署中丢失了,但是它并没有抱怨缺少文件或资源。
下面的代码在此行上给我“编译器错误消息:CS1003:语法错误,预计在第29行出现'>'”:
public class _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml : System.Web.Mvc.WebViewPage < SecurityGuard.ViewModels.DashboardViewModel() > {
但是在此文件或我可以找到的源文件中没有不匹配的括号。
Execute中的所有内容似乎都可以从给定的源文件中正确地重新配置。
#pragma checksum "C:\{path}\Areas\SecurityGuard\Views\Dashboard\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "CB3D0E13D4917D76BCD475640DD7740F6F1AB1D5"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASP {
using System;
....
public class _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml : System.Web.Mvc.WebViewPage<SecurityGuard.ViewModels.DashboardViewModel()> {
#line hidden
public _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml() {
}
protected ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}
public override void Execute() {
#line 2 "C:\{path}\Areas\SecurityGuard\Views\Dashboard\Index.cshtml"
ViewBag.Title = "Index";
Layout = "~/Areas/SecurityGuard/Views/Shared/_SecurityGuardLayoutPage.cshtml";
....
}
源文件
@model SecurityGuard.ViewModels.DashboardViewModel
@{
ViewBag.Title = "Index";
Layout = "~/Areas/SecurityGuard/Views/Shared/_SecurityGuardLayoutPage.cshtml";
}
<h2>
Manage Users and Roles</h2>
<div class="fl w48pc mr20">
<fieldset>
<legend>Manage Users</legend>
<p>@Html.ActionLink("Manage Users", "Index", "Membership", new { area = "SecurityGuard" }, null)
| @Html.ActionLink("Create User", "CreateUser", "Membership", new { area = "SecurityGuard" }, null)</p>
<table>
<tr>
<td>
Total Users:
</td>
<td>@Model.TotalUserCount
</td>
</tr>
<tr>
<td>
Users Online:
</td>
<td>@Model.TotalUsersOnlineCount
</td>
</tr>
</table>
</fieldset>
</div>
<div class="fr w48pc">
<fieldset>
<legend>Manage Roles</legend>
<p>@Html.ActionLink("Manage Roles", "Index", "Role", new { area = "SecurityGuard" }, null)</p>
<table>
<tr>
<td>
Total Roles:
</td>
<td>@Model.TotalRolesCount
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</fieldset>
</div>
引用的模型
using System;
....
namespace SecurityGuard.ViewModels
{
public class DashboardViewModel
{
public string TotalUserCount { get; set; }
public string TotalUsersOnlineCount { get; set; }
public string TotalRolesCount { get; set; }
}
}
答案 0 :(得分:0)
该行代码包含< SecurityGuard.ViewModels.DashboardViewModel() >
,但我认为这些括号不属于其中。尝试将其更改为<SecurityGuard.ViewModels.DashboardViewModel>
,看看它是否可以编译。