Unity 5.6 assembly importer changes managed manifest mscorlib 2.0.0.0 reference to 4.0.0.0

We’re using Easy Decal and it looks like the Unity API patcher is reaching into their ch.sycoforge.Decal.dll assembly to change an API call (per ildasm diffs)…

.custom instance void [UnityEngine]UnityEngine.ExecuteInEditMode::.ctor() = ( 01 00 00 00 ) …
However it is also adding a reference in the managed assembly manifest…

PROCESSED BY 5.6
.assembly extern mscorlib as mscorlib_4
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4…
.ver 4:0:0:0
}

And Visual Studio does not like that. Unity doesn’t seem to have a problem with it…

Warning The primary reference “ch.sycoforge.Decal” could not be resolved because it has an indirect dependency on the .NET Framework assembly “mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” which has a higher version “4.0.0.0” than the version “2.0.0.0” in the current target framework. MarkOfWar.Plugins

I can hack the manifest, but a fix would be goodness.

  • thanks

We are in the process of reproducing this with a test assembly. It really seems like a Unity bug introduced by version 5.6.

Agreed - I believe it to be a bug introduced with Unity 5.6. My guess would be that they are accidentally calling the 4.0 ilasm, or it is getting mscorlib from the system env instead of from an explicit 2.0 location…

Here’s my workaround…

@ off
setlocal
set EasyDecalRoot=[Your path to Assets\Easy Decal]
set Path=D:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0;%path%
set Path=C:\Windows\Microsoft.NET\Framework\v2.0.50727;%path%
set ilasm=D:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\ilasm.exe
set ildasm=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\ildasm.exe
:Step1
call “ildasm” /NOBAR /ALL ch.sycoforge.Decal_ORIGINAL.dll /out=ch.sycoforge.Decal_ORIGINAL.il
copy /y “%EasyDecalRoot%\Easy Decal\Scripts\ch.sycoforge.Decal.dll” ch.sycoforge.Decal_BAD.dll
call “ildasm” /NOBAR /ALL ch.sycoforge.Decal_BAD.dll /out=ch.sycoforge.Decal_BAD.il
copy /y ch.sycoforge.Decal_BAD.il ch.sycoforge.Decal.il
echo ACTION REQUIRED: Remove reference to mscorlib_4 and close notepad to continue…
start /wait notepad.exe ch.sycoforge.Decal.il
:Step2
call “ilasm” /NOLOGO /QUIET /DLL /NOAUTOINHERIT ch.sycoforge.Decal.il
call “ildasm” /NOBAR /ALL ch.sycoforge.Decal.dll /out=ch.sycoforge.Decal_FIXED.il
start windiff ch.sycoforge.Decal_ORIGINAL.il ch.sycoforge.Decal_FIXED.il
:Step3
copy /y ch.sycoforge.Decal.dll “%EasyDecalRoot%\Easy Decal\Scripts\ch.sycoforge.Decal.dll”

1 Like

And it just did it to Tazman Audio’s Fabric assembly, after I moved to their patch version. So, not just Easy Decal.

1 Like

Thanks for sharing your workaround! Much appreciated. We submitted a bug report and are waiting for an official statement.

Still seeing the problem with a fresh install of todays Unity 5.6.1p2. Booth assemblies munged improperly.

We submitted a bug report (case #916719), but haven’t heard back until now.

Hmm. Not seeing that case number. Perhaps it is flagged as private or not vetted. Do you have a link? - thanks

It’s flagged as private because we have included the core of the Easy Decal framework (we couldn’t figure out what part exactly triggers the injection). I’ll send you the link in PM.

Case has been confirmed and classified as an bug. Waiting for the answer of the responsible dev team.

Is this fixed in Unity 2017 perhaps? Maybe time for me to bite the bullet :slight_smile:

With Unity 2017.1.0p2, it looks like it’s now a compiler warning in Visual Studio, not an error…

Severity Code Description Project File Line Suppression State
Warning The primary reference “ch.sycoforge.Decal” could not be resolved because it has an indirect dependency on the .NET Framework assembly “mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” which has a higher version “4.0.0.0” than the version “2.0.0.0” in the current target framework. MarkOfWar.Plugins

1 Like

Still a problem for Unity 2017.1.0p5

And 2017.2 beta patch 10

I am only having this issue when debugging, but I CAN debug by choosing “use latest build”. It apparently uses the dll unity built for you when it compiled so works fine. All builds work fine for me, even UWP.

1 Like

Seems to throw now a warning too in Unity 5.6.3…

Received an official answer today: This issue should be fixed in Unity 2017.2 with a back port to 2017.1 and maybe also 5.6.x.

1 Like

Finally! This issue seems to be fixed in 2017.2 and 5.6.4. P1. :slight_smile:

The plug-in’s DLL in your project has been corrupted by the API Updater. So it’s just a matter of replacing it with the original DLL from the plug-in package. That may fix the problem for the time being.

Extract the plug-in’s package in a separate project, and then copy the original un-updated DLL over into your project, replacing your corrupted DLL.