This documentation is archived and is not being maintained.

Compiler Error CS0687 

Error Message

The namespace alias qualifier '::' always resolves to a type or namespace so is illegal here. Consider using '.' instead.

This error occurs if you used something which the parser interpreted as a type in an unexpected place. A type or namespace name is valid only in a member access expression, using the member access (.) operator. This could occur if you used the global scope operator (::) in another context.

Example

The following sample generates CS0687:

// CS0687.cs

using M = Test;
using System;

public class Test 
{
    public static int x = 77;

    public static void Main() 
    {
        Console.WriteLine(M::x); // CS0687
        // To resolve use the following line instead:
        // Console.WriteLine(M.x);
    }
}
Show: