Robert Thain
Robert Thain

Reputation: 11

Compiler Error Message: CS1002: ; expected but there is a ;

Im a PHP guy and have inherited an aspx site with an issue. I have resolved one problem but now get the following error;

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

Source Error:

Line 63: <%-- --%>
Line 64: <%
Line 65: Dim MM.XSLTransform mm_xsl = new MM.XSLTransform();
Line 66: mm_xsl.setXML("http://omfaxnews.wordpress.com/feed/");
Line 67: mm_xsl.setXSL(Server.MapPath("wpxsl_fp.xsl"));

Source File: c:\projects\www_omfax_co_uk\default_b.aspx Line: 65

Show Detailed Compiler Output:

Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET
Version:2.0.50727.3614

on this page 'http://www.omfax.co.uk/default_b.aspx'

The code I'm using is;

<%
Dim MM.XSLTransform mm_xsl = new MM.XSLTransform();
mm_xsl.setXML("http://omfaxnews.wordpress.com/feed/");
mm_xsl.setXSL(Server.MapPath("wpxsl_fp.xsl"));
Response.Write(mm_xsl.Transform());
%>

and as you can see there is a ';'. Any and all help would be gratefully received.

Upvotes: 1

Views: 4329

Answers (1)

Oded
Oded

Reputation: 498904

Are you using VB.NET or C#?

The Dim is from VB.NET, the ; endings are from C# - you can't mix them like this.

The error message (CS1002) suggests that this is a C# site, so the code should be like this:

<%
MM.XSLTransform mm_xsl = new MM.XSLTransform();
mm_xsl.setXML("http://omfaxnews.wordpress.com/feed/");
mm_xsl.setXSL(Server.MapPath("wpxsl_fp.xsl"));
Response.Write(mm_xsl.Transform());
%>

I dropped the Dim statement.

Upvotes: 8

Related Questions