The nuget KeenClient package installed for a project that targets .NET 3.5 will fail at runtime when trying to load Netwonsoft.Json.dll.
Repo steps:
Open Visual Studio 2015 Community Edition Update 3
Create a new C# console application (File->New->Project..., select .NET Framework 3.5, Visual C#->Console Application)
Open nuget package manager console and run PM> Install-Package KeenClient
Paste the following code into Program.cs and add a valid project and write key:
using Keen.NET_35;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace keen_35_test_console
{
class Program
{
static void Main(string[] args)
{
var projectId = "";
var writeKey = "";
var project = new ProjectSettingsProvider(
projectId,
writeKey: writeKey
);
var client = new KeenClient(project);
var collection = "test_collection";
client.AddEvent(collection, new { string_key = "3.5", numeric_key = 7.123 });
}
}
}
5. Run the program
Expected:
6. Event is added to the "test_collection" collection.
Actual:
6. Program crashes with a System.IO.FileLoadException.
Exception details:
An unhandled exception of type 'System.IO.FileLoadException' occurred in keen_35_test_console.exe
Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Perhaps this is because there are version conflicts in the version of Newtonsoft.Json being referenced. The root KeenClient.nuspec references version 6.0.3 of Newtonsoft.json, while Keen.NET_35.csproj references ..\packages\Netwonsoft.Json.8.0.3\lib\net35\Netwonsoft.Json.dll. Keen.NET_35/packages.config also references version 8.0.3 of the library. If I manually install version 8.0.3 instead of version 6.0.3, the program runs as expected. So the solution seems to be reference version 8.0.3 in KeenClient.nuspec for target "net35".
The nuget KeenClient package installed for a project that targets .NET 3.5 will fail at runtime when trying to load Netwonsoft.Json.dll.
Repo steps:
namespace keen_35_test_console { class Program { static void Main(string[] args) { var projectId = "";
var writeKey = "";
}