Search Unity

Question Asmdef Version Definitions not detecting when package missing/updated.

Discussion in 'Editor & General Support' started by crazyjackel, Jan 24, 2022.

  1. crazyjackel

    crazyjackel

    Joined:
    Oct 10, 2018
    Posts:
    18
    https://forum.unity.com/threads/asmdef-questions.651517/#post-4595680

    I am working with version defines trying to make a soft-dependency on a package (UniRX) so that if a user has the latest version, then they can have additional functionality based on precompiles.

    I installed the package via the package manager and the Asmdef worked, but when I removed it, the definition (UNIRX_PRESENT) still evaluates to true within Visual Studio, which stops compilation. Only when I edit the Asmdef does it update. Is there a way to have it auto-update the defines whenever I install or remove a package?

    For Reference, here is my Asmdef with name replaced:

    Code (CSharp):
    1. {
    2.     "name": "myAsmdefName, real one exists.",
    3.     "rootNamespace": "",
    4.     "references": [
    5.         "GUID:560b04d1a97f54a4e82edc0cbbb69285"
    6.     ],
    7.     "includePlatforms": [],
    8.     "excludePlatforms": [],
    9.     "allowUnsafeCode": false,
    10.     "overrideReferences": false,
    11.     "precompiledReferences": [],
    12.     "autoReferenced": true,
    13.     "defineConstraints": [],
    14.     "versionDefines": [
    15.         {
    16.             "name": "com.neuecc.unirx",
    17.             "expression": "7.1.0",
    18.             "define": "UNIRX_PRESENT"
    19.         }
    20.     ],
    21.     "noEngineReferences": false
    22. }