Add Binding redirects tests
This commit is contained in:
parent
4ccd88d00e
commit
c82d3cc08d
25 changed files with 645 additions and 55 deletions
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="3.5.0.0" newVersion="8.0.0.0" />
|
||||
<bindingRedirect oldVersion="4.5.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Some.Foo.Assembly" publicKeyToken="814f48568d36eed5" culture="neutral" />
|
||||
<bindingRedirect oldVersion="3.0.0.0" newVersion="5.5.5.1" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="Setting1" value="Hello"/>
|
||||
<add key="Setting2" value="World"/>
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"compile": [
|
||||
"../src/*.cs"
|
||||
],
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "8.0.3",
|
||||
"Microsoft.AspNet.Mvc": "3.0.50813.1",
|
||||
"Unity.Mvc": "3.0.1304",
|
||||
"dotnet-desktop-binding-redirects": "1.0.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"compile": [
|
||||
"../src/*.cs"
|
||||
],
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "8.0.3",
|
||||
"Microsoft.AspNet.Mvc": "3.0.50813.1",
|
||||
"Unity.Mvc": "3.0.1304",
|
||||
"dotnet-desktop-binding-redirects": "1.0.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BindingRedirects
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private const string ExpectedNewtonSoftVersion = "8.0.0.0";
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
return VerifyJsonLoad();
|
||||
}
|
||||
|
||||
private static int VerifyJsonLoad()
|
||||
{
|
||||
WriteLine("=======Verifying Redirected Newtonsoft.Json assembly load=======");
|
||||
|
||||
int result = 0;
|
||||
|
||||
try
|
||||
{
|
||||
var jsonAsm = typeof(Newtonsoft.Json.JsonConvert).Assembly;
|
||||
var version = jsonAsm.GetName().Version.ToString();
|
||||
if (version != ExpectedNewtonSoftVersion)
|
||||
{
|
||||
WriteLine($"Failure - Newtonsoft.Json: ExpectedVersion - {ExpectedNewtonSoftVersion}, ActualVersion - {version}");
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLine($"Failed to load type 'Newtonsoft.Json.JsonConvert'");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void WriteLine(string str)
|
||||
{
|
||||
var currentAssembly = Assembly.GetExecutingAssembly().GetName().Name;
|
||||
Console.WriteLine($"{currentAssembly}: {str}");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue