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…
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.
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”
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.
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
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.
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.