C# Error CS1679 – Invalid extern alias for ‘/reference’; ‘{0}’ is not a valid identifier

C# Error

CS1679 – Invalid extern alias for ‘/reference’; ‘{0}’ is not a valid identifier

Reason for the Error & Solution

Invalid extern alias for ‘/reference’; ‘identifier’ is not a valid identifier

When using the external assembly alias feature of the /reference option, the text that follows /reference: and that precedes the ‘=’ must be a valid C# identifier or keyword according to the C# Language Specification.

To correct this error, change text before the "=" to a valid C# identifier or keyword.

Example

The following example generates CS1679.

// CS1679.cs  
// compile with: /reference:123$BadIdentifier%=System.dll  
class TestClass {  
    static void Main()  
    {  
    }  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...