I have an MVC 5 project that targets .net framework 4.52 and I installed the System.ValueTuple through Nuget. I'm using Visual Studio 2017 on Windows 7. During development, Visual Studio doesnt complain about the Tuple return type but when I build I get an array of errors:
error CS1519: Invalid token '(' in class, struct, or interface member declaration
error CS1519: Invalid token ',' in class, struct, or interface member declaration
error CS1519: Invalid token ')' in class, struct, or interface member declaration
error CS1520: Method must have a return type
error CS1026: ) expected
and more..
This is the method that is breaking:
public (bool, string) GetSettings()
{
if (settingsFile.IsNullOrEmpty())
throw new Exception("Settings file is null or empty!");
try
{
var definition = new { active = false, excludeList = "" };
var obj = JsonConvert.DeserializeAnonymousType(settingsFile, definition);
return (obj.active, obj.excludeList);
}
catch
{
//TODO: log exception.
return (false, string.Empty);
}
}
I don't know how to fix this except to think that it is just not compatible with my framework version. Several extensive online searches have revealed nothing on this.