Hey ive been trying to put my code into a DLL and am having some problems. No matter which DLL i bring into Unity I get the same error Code (csharp): Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'TestDLL'. all that is in this dll is Code (csharp): using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestDLL { public class TestClass { public bool ReturnTrue() { return true; } } } I dont see why this wont work. It works when i use the DLL in other projects in visual studio. Is this a Unity problem? I have Unity Pro.
I was playing around and started a brand new Unity project and dragged in my DLL and it worked! But when I created a new c# script, I got that error. I dont try to reference the DLL at all in my script yet, its just a default new Unity Script and i get that error. Any ideas why that would happen?
Change your target framework to 2.0, nothing higher and then simply remove the using statement for Linq, wala will work
Is there anything that works in 2.0 which doesn't work in 3.5? In my experience so far, 3.5 is fine, so long as you avoid library features that aren't supported. You find out pretty quickly which ones they are, and I always got the impression they just didn't exist in 2.0. There are quite a few things in 2.0 that won't work in Unity too, at least in some contexts (e.g. Xbox, iOS, webplayer), so you still need to be ready to avoid them.
It's not 2.0 that is a problem, it was the version of Mono, you have to review the methods in Mono to determine if you can use them in Unity, just because it is in the Microsoft framework has no bearing as to if it will work or not, it has to exist in Mono or the version of Mono that Unity is using which all of it is based off 2.0 core, some improvements to handle a little more but always refer back to Mono.
Came across this thread while searching for the OP's issue myself. I can confirm that switching the build profile to 3.5 client edition gets rid of the compile issues inside of Unity (version 3.5)