VS.Net color coding bugs with inline code

J

Jon Maz

Hi,

I am writing inline code .aspx pages using VS.Net 2002. The color coding
seems to work for VB.NET inline, and not for C# inline (see below).

Does anyone know how to get this working for C#?

TIA,

JON




------------------------------------------

<%@ Page Language="C#" %>

<script runat="server">

private void Page_Load(object sender, System.EventArgs e)
{
//color coding doesn't work - this line is black
}

</script>


------------------------------------------


<%@ Page Language="VB" %>

<script runat="server">

Sub Page_Load(sender as Object, e as EventArgs)
'color coding works - this line is green
End Sub

</script>


------------------------------------------
 
J

Jon Maz

Whaaaaaaaaaaaaaaat?!?!? I hope that makes sense to *someone* out there,
'cos it don't make much sense to me....

Ah well, thanks for letting me know, Martin.

:-(

JON

PS Don't suppose anyone knows a workaround?
 
M

Mikhail Arkhipov (Microsoft)

It works (sort of) in VB simply by accident. Technically neither VS 2002 nor
VS 2003 support coloring or intellisense in inline code. What you see is not
VB color, it is vbscript color. Default server script language in *classic*
ASP is vbscript and that's why <script runat="server"> is colorized using
vbscript engine. You can get colorization of C# using jscript engine by
setting page default server script to jscript. Colorization will be odd
though :)


Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights.


On 10/11/04 7:39, in article #FSgD$
 
J

Jon Maz

Hi Mikhail,

Well, anything is better than nothing.... How *do* you change the default
server script to jscript? I'm looking around and can't find the setting....

Thanks,

JON
 
M

Mikhail Arkhipov (Microsoft)

There are two ways, none of them perfect

1. Temporary remove runat=server from the script block

OR

2. Temporary add language="javascript" to the script tag

Don't forget to remove the change when you run the page. Bit of a hassle, I
agree. Fortunately, upcoming VS 2005 provides full language support in
server script blocks.

Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights.
 
J

Jon Maz

Hi Mikhail,

Mmm, you're right, that is a bit of a hassle...

Do you know if the setting that makes VBScript the default server script
language is hard-coded in a file somewhere in C:\Program Files\Microsoft
Visual Studio .NET, and could therefore be changed?

Cheers,

JON
 
M

Mikhail Arkhipov (Microsoft)

It is hardcoded :-(

Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights.
 
J

Jon Maz

Hi Mikhail,

One trick I use with VS.Net is to set the Page Layout in design mode to
FlowLayout instead of GridLayout, using the following hack:

C:\Program Files\Microsoft Visual Studio .NET 2003\
VC#\VC#Wizards\CSharpAddWebFormWiz\Templates\1033\WebForm1.aspx

Change the body tag from:
<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">
to:
<body MS_POSITIONING="FlowLayout">

Just to check - you're saying there is *no* equivalent hack for changing the
default server script language to jscript?

Thanks for all the help,

JON
 
M

Mikhail Arkhipov (Microsoft)

You don't have to use hacks to set page layout to flow, just right click on
project node in Solution Explorer, choose Properties | Web settings and set
default page layout to flow :)

However, vbscript default for ASP is hardcoded in C++ logic since this
default never changes and it was not necessary to add extra flexibility.
Colorizer simply assumes that if page is server-type and language attribute
is missing or unrecognized, the language is vbscript.
 
G

Greg Burns

However, vbscript default for ASP is hardcoded in C++ logic

I thought I heard VS.NET was built with C#? Or are you referring to
something else?

Greg
 
M

Mikhail Arkhipov (Microsoft)

VS, including VS 2005 is COM/OLE based and is 80% C++. Just look at amount
of native code dlls compared to managed assemblies. It is way too expensive
to rewrite in another language. Property grid is managed, parts of Web Form
editor, XML schema and Data designers, a few other things. VS 2005 has a bit
more C#: new XML editor, build subsystem, team server, new Enterprise tools.
However, majority is still C++. Typically new components tend to be managed,
legacy parts remain native.

My team owns HTML editor, btw.

Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights.
 
G

Guest

I noticed in VS 2005 that ASP 2.0 color-coding was removed.
I still have VS .NET 2003 installed and the syntax is color-coded.

How can I add the syntax color-coding back to the .asp pages in VS .Net 2005?
 
M

Mikhail Arkhipov (Microsoft)

You can't, it's simply broken in Beta 1. I fixed it couple of weeks ago, it
should be working properly in Beta 2.

Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights.

On 10/18/04 11:01, in article
(e-mail address removed), "Brett Mathe" <Brett
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top