Search Unity

How to reference DLLs inside packages?

Discussion in 'Package Manager' started by SLGSimon, Jul 24, 2019.

  1. SLGSimon

    SLGSimon

    Joined:
    Jul 23, 2019
    Posts:
    80
    I am trying to get a reference to Microsoft.CodeAnalysis.CSharp.dll from the com.unity.code-analysis package into an asmdef.

    I have referenced "CodeAnalysis.Tests.Editor" in the asmdef references (with includePlatforms having just "Editor"), and added all the dlls to the "precompiledReferences":
    "precompiledReferences": [
    "Microsoft.CodeAnalysis.CSharp.dll",
    "Microsoft.CodeAnalysis.CSharp.Workspaces.dll",
    "Microsoft.CodeAnalysis.CSharp.Scripting.dll",
    "Microsoft.CodeAnalysis.dll",
    "Microsoft.CodeAnalysis.Scripting.dll",
    "Microsoft.CodeAnalysis.Workspaces.dll",
    "System.Collections.Immutable.dll",
    "System.Composition.AttributedModel.dll",
    "System.Composition.Convention.dll",
    "System.Composition.Hosting.dll",
    "System.Composition.Runtime.dll",
    "System.Composition.TypedParts.dll",
    "System.Reflection.Metadata.dll",
    "System.Runtime.Loader.dll"
    ],

    This however doesn't work. I don't see the dlls in the references in the generated project and I get compile errors.

    What do I need to do to get this to work?
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    did you use the GUI or you manually edited the asmdef?
    what version of Unity are you on?
    try to restart the editor

    maybe you also need
    "overrideReferences": true,
    if you manually edited the json
     
    SLGSimon likes this.
  3. SLGSimon

    SLGSimon

    Joined:
    Jul 23, 2019
    Posts:
    80
    Yeah,
    overrideReferences
    was it.