Microsoft KB Archive/821173

= PRB: &quot;Identifier Expected&quot; Error Message When You Compile an Upgraded Visual C# .NET Project =

Article ID: 821173

Article Last Modified on 1/17/2007

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-



SYMPTOMS
You can use Java Language Conversion Assistant (JLCA) to convert your Visual J++ projects and Java code to Visual C# .NET code. However, if you do the following, you receive an error message:  Convert your Visual J++ project to Visual C# .NET by using JLCA. Add a new item (such as a Web Form or a Class) to the generated Visual C# .NET project. Try to build the project.

You receive the following compiler error message:

error BC30203: Identifier expected



Note You may also notice a red error indicator mark (or squiggly) after the namespace keyword in the code.



CAUSE
This behavior occurs because the wizard cannot assign a value to the RootNamespace namespace. When JLCA converts the Visual J++ project, JLCA generates a project file (for example, .csproj) that contains project settings for the Visual C# .NET project. However, the JLCA tool does not assign a value for the RootNamespace namespace in the project file because the tool cannot identify the namespace value for the class that the wizard generates.



RESOLUTION
To resolve this problem, type the namespace in the project properties as follows:  Before you add a new item to the project, type the value for Default namespace in Properties for the project. To do this, follow these steps:  In Solution Explorer of Visual Studio .NET, right-click the generated project name, and then click Properties. In the Default Namespace text box, type the value for namespace.</li> Click OK.</li></ol>

-or-</li> Before you add a new item to the project, type the value for RootNamespace in the project file. To do this, follow these steps:  Start a text editor such as Notepad.</li> In the text editor, open the project file of the generated Visual C# project.</li> In the project file, type the value for RootNamespace.</li> Save the project file.</li></ol> </li></ul>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce the Behavior

 * 1) Start Visual Studio .NET.
 * 2) On the File menu, point to Open, and then click Convert.
 * 3) Follow the onscreen instructions in the JLCA wizard to convert your Visual J++ project to a Visual C# .NET project.

The wizard generates a Visual C# .NET project.
 * 1) In Solution Explorer of Visual Studio .NET, right-click the generated project name, point to Add, and then click Add New Item.
 * 2) In Templates, click Class, and then click Open.
 * 3) In the default code that the wizard generates for Class, you may notice a red error indicator mark after the namespace keyword. You notice the same behavior when you add a Windows Form, a Component Class, or a User Control class to the generated Visual C# .NET project.
 * 4) On the Build menu, click Build Solution.

<div class="references_section">