Search Unity

Question Newtonsoft.Json error only with Cloud Build

Discussion in 'Unity Build Automation' started by alan-lawrance, Feb 22, 2022.

Thread Status:
Not open for further replies.
  1. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    Our project doesn't have any errors in the Editor or as a standalone build made manually, but the build fails on Unity Cloud Build with:

    Assets\CloudinaryDotNet\ApiShared.Internal.cs(16,11): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

    (and many similar errors after that)

    We just added CloudinaryDotNet, but like I said there aren't any build issues when done manually.

    We have the "Netwtonsoft Json" in Packages. From the packages-lock.json file:

    "com.unity.nuget.newtonsoft-json": {
    "version": "2.0.0",
    "depth": 1,
    "source": "registry",
    "dependencies": {},
    "url": "https://packages.unity.com"
    },

    The Cloudinary .NET SDK comes from: https://github.com/cloudinary/CloudinaryDotNet
     
  2. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    Things I've tried that have had no impact:

    1. Clean Build
    2. Change .NET compatibility from 2.0 to 4.x
     
  3. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    Turns out I needed to add the package to manifest.json:

    "com.unity.nuget.newtonsoft-json": "2.0.0",

    Not sure why this wasn't needed to build locally.
     
    paulflatfishgames and Juanola_ like this.
  4. paulflatfishgames

    paulflatfishgames

    Joined:
    Sep 29, 2022
    Posts:
    1
    Probably saved me several hours of headaches, thanks!
     
  5. garrygorman

    garrygorman

    Joined:
    Feb 17, 2022
    Posts:
    2
    can you explain to me how you add the package to manifest.json.
    I have the same error as you. It started just after I added Unity Version Control
     
  6. garrygorman

    garrygorman

    Joined:
    Feb 17, 2022
    Posts:
    2
    Thanks Alan,

    you saved my bacon.

    Garry
     
Thread Status:
Not open for further replies.