I\'m using VS2017 RC and my application targets net framework 4.6.1.
I have two assemblies referencing System.ValueTuple 4.3
MyProject.Services MyProject.Web
If anyone falls in the same trap, to fix this you need to update this package: Microsoft.Net.Compilers to 2.0 (you need to show pre-release)
I just want to add to the other answers.
Remove System.valuetuple from references. Otherwise, it doesn't work and I do not know why. Basically, value tuple is already in 4.7.2 and so if you use visual studio 2019 you're all set.
If you use visual studio 2019 and I did, that's what worked for me. I don't exactly know why. No need for nugget. No need to reference that directly.
Target your project to use .net framework 4.7.2 and remove references to valuetuple.
I think It is because you've not defined fCount, cCount and aCount. Try this
public async Task<(int fCount, int cCount, int aCount)> GetAllStatsAsync()
{
// Some code...
//fCount, cCount, aCount are not defined here, so you should define them
var fCount = 0;
var cCount= 0;
var aCount = 0;
return (fCount , cCount, aCount );
//Other ways:
//return (fCount : 0, cCount: 0, aCount : 0);
//return new (int fCount , int cCount, int aCount ) { fCount = 0, cCount = 0, aCount = 0 };
}
public async Task<HttpResponseMessage> GetInfoAsync()
{
// Some code...
var stats = await _myClass.GetAllStatsAsync();
var vm = new ViewModel
{
FCount = stats.fCount,
CCount = stats.cCount,
ACount = stats.aCount
};
return Request.CreateResponse(HttpStatusCode.OK, vm);
}
Take a look at this post