My plugin throws error TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrame

As the title states I’m writing an Editor Plugin for something that I want to make simpler. The code runs run as a cs file so I decided to bundle it up as a dll in case I want to make it available to others and to learn a bit about dll files. I’ve made a new class library project in Visual Studio 2013 and copied my code over and compiled it.

The code still runs but prompts me with a super annoying error every time the editor refreshes the script, the exact error is.

TypeLoadException:Couldnot load type 'System.Runtime.Versioning.TargetFrameworkAttribute’from assembly ‘MyPlugin’.
System.MonoCustomAttrs.GetCustomAttributesBase(ICustomAttributeProvider obj,System.Type attributeType)(at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/MonoCustomAttrs.cs:108)
System.MonoCustomAttrs.GetCustomAttributes(ICustomAttributeProvider obj,System.Type attributeType,Boolean inherit)(at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/MonoCustomAttrs.cs:151)
System.MonoType.GetCustomAttributes(System.Type attributeType,Boolean inherit)(at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/MonoType.cs:595)
UnityEngine.AttributeHelperEngine.CheckIsEditorScript(System.Type klass)(at C:/buildslave/unity/build/Runtime/Export/AttributeHelperEngine.cs:107)

I’ve checked the attributes for the project and it says that it is targeting .NET 4, I’ve tried both debug and release versions of the DLL and get the same issue, is there a step I am missing here or is there something else I can try to fix this?

You need to set your dll to target .NET 3.5

1 Like

Yes thanks I found this out and got it working, cheers.

i had the same problem and i changed my plateforme into .net 3.5 but the error remain the same :eyes::frowning: