How do I add a system.core.dll reference to my pro

2019-02-19 10:09发布

问题:

I'm trying to use System.Linq because it has an 'Unknown resolve error'. I've done a bit of looking around on how to do this and all I can find is people saying that it needs to be added or that they added it. I'm wondering how to add it to my project so that I can use the '.ToList' function.

回答1:

If you are doing a traditional iOS or Android project with Xamarin Studio, by default a reference to System.Core should already be added.

However, if you're creating a PCL you will see a reference to it, but it will be red in the References folder. This is because PCLs are not fully supported yet. There is a work around though.

You can copy the Core DLL from your Mono install and reference it in your PCL project. I was able to find this PCL on my Mac here: /Library/Frameworks/Mono.framework/Versions/3.0.10/lib/mono/4.0 - mscorlib.dll

I usually have a folder called "DLLs" inside my project folder that I put these type of DLLs and reference.

Hopefully in the near future we won't have to mess with hacks like this with PCLs.