It seems this error is due to the version of your MSBuild, the old version of MSBuild can only compile C # version 4, and your code is written in C # version 6 format (set the default value for the properties).
An example of writing code in C # version 6:
public static string HostName { get; set; } = ConfigurationManager.AppSettings["RabbitMQHostName"] ?? "";
For MSBuild to compile your code, you need to write in C # 4 style
public static string HostName { get; set; } public SomeConstructor() { HostName = ConfigurationManager.AppSettings["RabbitMQHostName"] ?? "";... }
or
public static string HostName { get { return ConfigurationManager.AppSettings["RabbitMQHostName"] ?? ""; } }
Hope this helps
source share