I have a project written in C# targetting .NET version 4.6.1 on Windows that I'm also compiling with mcs on mono 4.2.1 on Debian Jessie.
The command I use to compile the program is
mcs -define:LINUX -langversion:experimental -platform:x64 -recurse:'*.cs' -optimize+ -r:$DLLS -out:$CURRENTDIR/program.exe
where $DLLS
is a list of DLLs in $CURRENTDIR
.
What bothers me is that the compiler throws the following warning. The program works as expected, but I'm clueless as to why this warning appears and how I can potentially fix it.
warning CS1701: Assuming assembly reference `Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' matches assembly `Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. You may need to supply runtime policy
Compilation succeeded - 1 warning(s)
All lines referencing Newtonsoft.Json in the project
$ grep -rh Newtonsoft .
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net461" />
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json;
The referenced DLL is version 8.0.0.0 according to these commands recommended in How to get the AssemblyVersion of a .Net file in Linux and I've tried getting the latest version via NuGet on both Windows (via Visual Studio 2015) and Linux via nuget.exe (v3.3.0).
$ monodis --assembly Newtonsoft.Json.dll | grep Version
Version: 8.0.0.0
$ strings Newtonsoft.Json.dll | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'
8.0.2.19309
The project originally used Newtonsoft.Json v7, but was updated to 8.0.2 before I ever compiled it under Linux.