PRB: CS0518 Compiler Error When You Build a Visual C# .NET Application (310905)



The information in this article applies to:

  • Microsoft Visual C# .NET (2002)

This article was previously published under Q310905

SYMPTOMS

When you build a Visual C# .NET application, you may receive the following error message in the compiler:
error CS0518: The predefined type 'type' is not defined or imported

CAUSE

The following are possible causes:
  • You may have specified the /nostdlib option from the command line compiler.
  • The program may contain a reference to the incorrect Mscorlib.dll file.
  • The Visual Studio .NET or .NET Framework Software Development Kit (SDK) may not be installed correctly on the system.
  • Residual components from an earlier installation of the .NET Framework SDK that are incompatible with the latest installation may remain on the system.

RESOLUTION

To resolve this problem, follow these steps:
  1. Make sure that you do not specify the /nostdlib option from the command line compiler.
  2. Make sure that the project refers to the correct Mscorlib.dll file.
  3. If steps 1 and 2 do not resolve the error, reinstall the .NET Framework SDK.

STATUS

This behavior is by design.

MORE INFORMATION

The /nostdlib option prevents the import of Mscorlib.dll, which defines the entire System namespace. Use this option if you want to define or create a user-specific System namespace.

Modification Type:MajorLast Reviewed:7/29/2002
Keywords:kbprb kbProd2Web KB310905