Search Unity

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

Discussion in 'Immediate Mode GUI (IMGUI)' started by gRntaus, May 10, 2015.

  1. gRntaus

    gRntaus

    Joined:
    Jul 16, 2012
    Posts:
    27
    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?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You need to set your dll to target .NET 3.5
     
    Warped likes this.
  3. gRntaus

    gRntaus

    Joined:
    Jul 16, 2012
    Posts:
    27
    Yes thanks I found this out and got it working, cheers.
     
  4. Hoptii

    Hoptii

    Joined:
    Jul 25, 2015
    Posts:
    1
    i had the same problem and i changed my plateforme into .net 3.5 but the error remain the same o_O ....:(