I created the following program
public class Program
{
static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}
When compiling the code in the command prompt (c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc hello.cs) which returns
Microsoft (R) Visual C# Compiler version 4.7.3056.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
The program still compiles so I thought no big deal. Based on other searches I've done I it seemed as if this message is only informational.
However, for the program
public class Program
{
static void Main()
{
System.Console.WriteLine(DateTime.Now.DayOfWeek);
}
}
the return is
Microsoft (R) Visual C# Compiler version 4.7.3056.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
hello.cs(5,28): error CS0103: The name 'DateTime' does not exist in the current context
which should work fine according to the pluralsight videos I'm following along with. After some searches many of the answers refer to changing the version of C# being used in the project but can't seem to translate that to working in the command prompt. What needs to change?
using System;is missing. You can compile it successfully with a fully name likeSystem.DateTime.Now.DayOfWeek.using System;and it cleared the error, but I still receive the message about language version support. Still works, but curious as to why I still receive the message.