Skip to content

Commit

Permalink
Upgrade to Elasticsearch.Net 7.0.0. This depends on net-standard2.0 (#96
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ultimaustin authored and markmcdowell committed Jun 12, 2019
1 parent 0318815 commit 14dbbd3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/NLog.Targets.ElasticSearch.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
<logger name="*" minlevel="Info" writeTo="elastic"/>
</rules>
</nlog>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 3 additions & 15 deletions src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Description>An NLog target that utilises the elasticsearch low level client.</Description>
<PackageLicenseUrl>https://raw.githubusercontent.com/ReactiveMarkets/NLog.Targets.ElasticSearch/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/ReactiveMarkets/NLog.Targets.ElasticSearch</PackageProjectUrl>
Expand All @@ -15,22 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Elasticsearch.Net" Version="7.0.0-alpha2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="NLog" Version="4.5.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="Elasticsearch.Net" Version="6.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Elasticsearch.Net" Version="6.4.2" />
<PackageReference Include="NLog" Version="4.6.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<PackageReference Include="Elasticsearch.Net" Version="6.1.0" />
</ItemGroup>

</Project>
9 changes: 0 additions & 9 deletions src/NLog.Targets.ElasticSearch/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
using System.Dynamic;
using System.Globalization;
using Newtonsoft.Json;
#if NET45
using System.Configuration;
#else
using Microsoft.Extensions.Configuration;
#endif
using System.IO;

namespace NLog.Targets.ElasticSearch
Expand Down Expand Up @@ -49,18 +45,13 @@ public static string GetConnectionString(this string name)
if (!string.IsNullOrEmpty(value))
return value;

#if NET45
var connectionString = ConfigurationManager.ConnectionStrings[name];
return connectionString?.ConnectionString;
#else
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", true, reloadOnChange: false); // CreateFileWatcher not supported on all platforms, and not needed

var configuration = builder.Build();

return configuration.GetConnectionString(name);
#endif
}
}
}

0 comments on commit 14dbbd3

Please sign in to comment.