Syntaxe error in the @Application directive in global.asax

W

WT

Hello,

Using VS2005, when I open the global.asax file, the editor underlines in
blue all the line with a tooltip saying 'Syntaxe error '.

<%@ Application Language="C#" Inherits="MyApp.Core.Global"
Codefile="Global.asax.cs" %>

But everything is running OK, the site is under a web application project.

Any indication on the reasonfor this welcome.

CS
 
J

Juan T. Llibre

re:
the site is under a web application project

Using Web Application Projects doesn't change the way the VS 2005 IDE sees the code.
WAP uses a new codebehind model, with changes in it which the VS IDE can't see.

re:
<%@ Application Language="C#" Inherits="MyApp.Core.Global" Codefile="Global.asax.cs" %>

That's standard syntax for ASP.NET 2.0/VS 2005 codebehind.

In WAP projects, that becomes :
<%@ Application Language="C#" Inherits="YourWebProjectName._Default" Codebehind="Global.asax.cs" %>

....but, to the VS 2005 IDE, that's incorrect syntax.

See : http://webproject.scottgu.com/Default.aspx
for details on the inner workings of WAP.
 
W

WT

Thanks, you confirme that the syntax error that appears even with CodeBehind
attribut IS NORMAL ?
 
W

Walter Wang [MSFT]

Hi,

The CodeBehind is for 1.1 compatibility. The CodeFile is not available to @
Application directive
(http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba
ckID=102720). Therefore you don't need either attribute here. However,
VS2005 IDE has a known issue here that will still report error for the
syntax, which is actually correct. You could safely ignore this error.
ASP.NET has its own compiler when you're debugging.

The workaround for the issue is DO NOT open the global.asax markup file at
all in IDE and there should be no compilation errors in the Error List.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top