Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Elasticsearch.Net 7.0.0. This depends on net-standard2.0 #96

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
}