开发者

The language of the file referenced by the 'CodeFile' attribute does not match the language specified by the 'Language' attribute in the current file

When trying to edit a aspx page in Visual Studio i get the error:

The language of the file referenced by the 'CodeFile' attribute does not matc开发者_开发技巧h the language specified by the 'Language' attribute in the current file.

What's the problem?

DocumentSearch.aspx:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" 
       AutoEventWireup="true" 
       CodeFile="DocumentSearch.aspx.cs" 
       Inherits="DocumentSearch" 
       Title="@Pepsi" %>
...

C# looks like it matches .cs to me.

DocumentSearch.aspx.cs:

using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class DocumentSearch : System.Web.UI.Page
{
   ...

What's the problem?


i found the problem. It's that The Visual Studio language support for C# has not been installed.

The error message i was getting was misleading. The problem was that Visual Studio did not have C# installed - not that there was any mismatch. The reason C# was not installed is because i ran the wrong version of Visual Studio.

From the start menu i ran:

Microsoft Visual Studio 2008

when i should have ran

Microsoft Visual Studio 2008

The problem, of course, is that the former isn't really Visual Studio. It's actually:

Microsoft Visual Studio 2008 Shell (integrated mode)

Which is why C# wasn't available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜