Search Unity

Assembly Definition not included in the build

Discussion in 'Unity Build Automation' started by TrueNoob141, Jun 4, 2020.

  1. TrueNoob141

    TrueNoob141

    Joined:
    Sep 18, 2019
    Posts:
    30
    I created an Assembly Definition with Define Constraints and set up a Custom Defines in the build target, but the assembly is not included in the build. Why? It's not supported?
     
  2. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Does your assembly definition work when building locally? Does your assembly definition work in Cloud Build if you remove the define constraints? There's pretty low usage of this feature so I haven't done very much investigation of how exactly asmdefs work but they definitely function in UCB.
     
  3. TrueNoob141

    TrueNoob141

    Joined:
    Sep 18, 2019
    Posts:
    30
    Code (CSharp):
    1. #if CUSTOM_DEFINE
    2.   Debug.Log("Work!"); // Work
    3.   CustomAsmdefNamespaceWithConstraints.Print("Not work"); // Unity Cloud compile error
    4. #endif
    :(

    > Does your assembly definition work when building locally?
    Yes. It's work with asmdef, with asmdef and constraint, without asmdef.

    > Does your assembly definition work in Cloud Build if you remove the define constraints?
    Yes. It's work without asmdef and with asmdef (no constraints).


    Thanks for the reply. I couldn't reply earlier because for some reason the asset (with this assembly) had an error (java.lang.ClassNotFoundException). I updated the asset and now it's ok, but the problem in Unity Cloud still remains.

    I think you can reproduce this behaviour:
    1. Switch to Android
    2. Install unitypackage https://github.com/SpaceMadness/lunar-unity-console
    3. [Optional] Follow the instruction: drag and drop prefab to the scene
    4. Create asmdef in LunarConsole and LunarConsole/Editor (for editor only)
    5. Add Define Constraints to these asmdef
    6. Add Custom Defines in the Unity Cloud
    7. Build it
    Expected behavior: the build contains Lunar Console (you can check it by using the asset)
    Actual behavior: the build doesn't contain Lunar Console
     
    Last edited: Jun 7, 2020
  4. oatsbarley

    oatsbarley

    Joined:
    Sep 13, 2013
    Posts:
    4
    We're getting this as well. I've got an asmdef in a folder with some library files that I only want to include in specific builds, and it has a LIBRARY_ENABLED (for example) constraint. I've also got some initialisation code elsewhere that references the library, and that's wrapped in a preprocessor directive using the same LIBRARY_ENABLED define.

    Ideally, the library should be included in the build (when the LIBRARY_ENABLED define is set) but it doesn't seem as if it is. The initialisation code is being included, and so we're getting an error on UCB compile.

    This looks like someone else having the same issue: https://forum.unity.com/threads/uni...define-symbols-for-asmdef-constraints.941366/