Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Help: Failed to update assembly warning when updating version in UPM #62

Open
2 tasks done
somethingSTRANGE opened this issue Jun 27, 2020 · 2 comments
Open
2 tasks done

Comments

@somethingSTRANGE
Copy link

somethingSTRANGE commented Jun 27, 2020

Expected behavior

When upgrading the package in UPM to 12.0.301, the upgrade should complete without warnings.

Actual behavior

The following warning was received after adding the 12.0.201 package to UPM and clicking the "Update to" button to upgrade to 12.0.301:

Failed to update assembly '<project_path>/Library/PackageCache/[email protected]/Plugins/Newtonsoft.Json Portable/Newtonsoft.Json.dll': Assembly reference folder does not exist: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5'.
UnityEditor.Scripting.APIUpdaterAssemblyHelper:DoesAssemblyRequireUpgrade(String) (at C:/buildslave/unity/build/Editor/Mono/Scripting/APIUpdater/APIUpdaterAssemblyHelper.cs:109)

Steps to reproduce

On my project and workspace,

  • Change the version to 12.0.201, 12.0.101, or some other version that you are not currently using
  • Click the "Update to" button

Details

Host machine OS running Unity Editor 👉 Windows 10 Pro, 1909, OS Build 18363.900

Unity build target 👉 Nintendo Switch

Newtonsoft.Json-for-Unity package version 👉 12.0.301 (but occurs when changing to 12.0.201 and 12.0.101.

I was using Unity version 👉 Unity 2018.4.23f1 LTS

The project was previously using "JSON .NET for Unity by ParentElement". That asset was remove from the project and the UPM was updated to use "jilleJr / Newtonsoft.Json-for-Unity" per the install guide instructions.

On my workstation, the "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework" contains the following folders: ".NETCore", ".NETFramework", "v3.0", and "v3.5". There is no ".NETPortable" folder at that location.

I have been able to build the project to various targets previously, including Windows and Nintendo Swtich, and haven't seen any requirements for .NETPortable. Is this framework required by "Newtonsoft.Json-for-Unity"? I didn't see this requirement documented. Will all team members that access this project need to install that framework?

The project is configured to use

  • Scripting Runtime Version: .NET 4.x Equivalent
  • Scripting Backend: IL2CPP (on the Switch target) and Mono (on Windows target)
  • API Compatibility Level: .NET Standard 2.0

Checklist

  • Shutdown Unity, deleted the /Library folder, opened project again in Unity, and problem still remains.
  • Checked to be using latest version of the package.
@applejag
Copy link
Owner

Hi @somethingSTRANGE ! Thanks for reporting this!

Disclosure: I've no experience with Nintendo Switch development and have not had the chance of using the switch target, so stuff might be misbehaving a lot.

What it seems like is that the .NET Portable variant of Json .NET was activated in your build. The portable variants is meant to be used in windows phone and some UWP targets, so don't know why it started up on your target.

Like a small details, this package currently contains 3 different DLLs of Json .NET, as there's different compatibilities around. The "AOT" one is the most compatible with all platforms, so safe bet is to change to that one.

This is where it gets tricky, because I do not have a Nintendo developer account so I will have to do some experiment remote debugging via you.

Try this

Copy the AOT variant of Newtonsoft.Json.dll and paste it into your Assets folder (preferably inside the Assets/Plugins folder), and then remove the package?

  1. Copy:
    <project>/Library/PackageCache/[email protected]/Plugins/Newtonsoft.Json AOT/Newtownsoft.Json.dll

  2. Into newly created Plugins folder, placing it at:
    <project>/Assets/Plugins/Newtonsoft.Json.dll

  3. Remove the UPM package, for example via the Package Manager window


If that works, please send me an update here, them I can update the package and you would soon see a jillejr.newtonsoft.json-for-unity version 12.0.302 with a fix so you can revert back to using the package and not raw DLLs.

@applejag
Copy link
Owner

Very detailed issue by the way. Good job! 😁

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants