在我的ASP.NET MVC应用程序中,我有一个.aspx文件。我在Visual Studio 2010 Project Explorer树中选择它并转到文件属性 - “构建操作”设置为“内容”。我将“Build Action”更改为“Compile”,并要求Visual Studio构建该项目。我收到以下错误消息编译器输出我的.aspx文件:如何让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
@KennyZ:我希望在Visual Studio中的项目构建期间调用ASP.NET预编译。 – sharptooth
Yor .cs或.vb文件是预编译的,而不是.aspx。该设置应该在项目属性中,并且不应该更改任何单个文件的设置。 – KennyZ