I have an existing Visual Studio project at work that I would like to build using the Mono toolset on a CI server and my mac, and most fixes have been quite minor and easy to fix (unused properties, etc). But the last error I am getting I seem unable to fix:
MyProj.csproj (default targets) -> /usr/local/Cellar/mono/22.214.171.124/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
CSC: error CS1701: Warning as Error: Assuming assembly reference Newtonsoft.Json, Version=126.96.36.199, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' matches assemblyNewtonsoft.Json, Version=188.8.131.52, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. You may need to supply runtime policy
Usually when this error comes up in a Visual Studio web project it is solvable by specifying a
bindingRedirect in the web.config, but that is not a file xbuild seems to care about (which makes sense when we are not creating web projects). So how can I somewhere specify something along the lines of what I put in my web.config?
This is what I would normally write to make all references to version 4.5 and 6.0 use the 6.0 assembly:
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-184.108.40.206" newVersion="220.127.116.11" /> </dependentAssembly>
So where can I put it? I found a confirmed a confirmed report on the Xamarin bug tracker mentioning putting it in app.config without it making any difference. Is it possible to tell xbuild just to ignore the error? It says "warning as error", so something seems to say that it should treat warnings as errors.