I'm porting a simple library (without deps) to netstandard1.0. Probably easy for you guys, but I can't see why I'm getting this build error when targeting netstandard1.0 on a simple class lib I have.
CS1061 'string' does not contain a definition for 'Any' and no extension method 'Any' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) MyProject..NETStandard,Version=v1.0
So, it seems is complaining about the Any method; an extension method part of the Linq libraries i presume. AFAIK, Linq is part of the NETStandard.Libary meta package for 1.0.
Code in question:
var numberString= "1234";
var isAllDigits = numberString.Any(t => !char.IsDigit((t))
My project.json:
{
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.0": { }
}
}
Changing my project.json to netstandard.1.2 resolves it, but afaik the Linq stuff is present in 1.0 and should be able to compile..?
Also, the portability tool ran fine and said I could target as low as netstandard1.0 as well.
So:
How can I tell System.Linq v.4.3.0 is not supported when creating libraries targeting netstandard1.0?
Since one idea of .net core is to keep the library is small as possible, linq and many extension methods are in a extra package.
Try installing Install-Package System.Linq.
Another thing i want to point out is the very helpful tool Reverse Package Search which allows you to search for classes and find the corresponding .net core package. Very helpful for porting to .net core.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With