【发布时间】:2012-09-19 14:18:50
【问题描述】:
在我的 ASP.NET MVC 应用程序中,我有一个 .aspx 文件。我在 Visual Studio 2010 项目资源管理器树中选择它并转到文件属性 - “构建操作”设置为“内容”。我将“构建操作”更改为“编译”并要求 Visual Studio 构建项目。我在编译器输出中收到以下关于我的 .aspx 文件的错误消息:
C:\PathToProject\MyFile.aspx(1,1): error CS0234: The type or namespace name 'global_asax'
does not exist in the namespace 'ASP' (are you missing an assembly reference?)
.aspx 文件的第一行是:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/My.Master" Inherits="System.Web.Mvc.ViewPage" %>
这让我想知道......
编译器试图抱怨什么以及如何让它编译 .aspx 文件?
【问题讨论】:
-
ASPX 文件未编译。你想做什么?
-
@KennyZ:我希望在 Visual Studio 中的项目构建期间调用 ASP.NET 预编译。
-
Yor .cs 或 .vb 文件将被预编译,而不是 .aspx。该设置应在项目属性中,您不必更改任何单个文件的设置。
-
您是否在寻找此类:System.Web.Compilation.ClientBuildManager ?
标签: asp.net .net asp.net-mvc visual-studio