diff --git a/Ductus.FluentDocker/Ductus.FluentDocker.csproj b/Ductus.FluentDocker/Ductus.FluentDocker.csproj index e3c9f6c..ae910c2 100644 --- a/Ductus.FluentDocker/Ductus.FluentDocker.csproj +++ b/Ductus.FluentDocker/Ductus.FluentDocker.csproj @@ -41,13 +41,6 @@ - - - - - - - diff --git a/Ductus.FluentDocker/Executors/ProcessExecutor.cs b/Ductus.FluentDocker/Executors/ProcessExecutor.cs index f2b420d..9df6dbb 100644 --- a/Ductus.FluentDocker/Executors/ProcessExecutor.cs +++ b/Ductus.FluentDocker/Executors/ProcessExecutor.cs @@ -46,11 +46,7 @@ public CommandResponse Execute() if (0 != Env.Count) foreach (var key in Env.Keys) { -#if NETSTANDARD1_6 - startInfo.Environment[key] = Env[key]; -#else startInfo.EnvironmentVariables[key] = Env[key]; -#endif } Logger.Log($"cmd: {_command} - arg: {_arguments}"); diff --git a/Ductus.FluentDocker/Extensions/CommandExtensions.cs b/Ductus.FluentDocker/Extensions/CommandExtensions.cs index de43d8c..eeb3592 100644 --- a/Ductus.FluentDocker/Extensions/CommandExtensions.cs +++ b/Ductus.FluentDocker/Extensions/CommandExtensions.cs @@ -161,20 +161,6 @@ public static bool IsEmulatedNative() } -#if NETSTANDARD1_6 - public static bool IsDockerDnsAvailable() - { - try - { - Dns.GetHostEntryAsync("host.docker.internal").Wait(); - return true; - } - catch (Exception ex) when (ex.GetBaseException() is SocketException) - { - return false; - } - } -#else public static bool IsDockerDnsAvailable() { try @@ -187,7 +173,6 @@ public static bool IsDockerDnsAvailable() return false; } } -#endif public static bool IsNative() { @@ -199,11 +184,7 @@ public static IPAddress EmulatedNativeAddress(bool useCache = true) if (useCache && null != _cachedDockerIpAddress) return _cachedDockerIpAddress; -#if NETSTANDARD1_6 - var hostEntry = Dns.GetHostEntryAsync("host.docker.internal").Result; -#else var hostEntry = Dns.GetHostEntry("host.docker.internal"); -#endif if (hostEntry.AddressList.Length > 0) { // Prefer IPv4 addresses diff --git a/Ductus.FluentDocker/Extensions/ResourceExtensions.cs b/Ductus.FluentDocker/Extensions/ResourceExtensions.cs index 65db804..b5d72a9 100644 --- a/Ductus.FluentDocker/Extensions/ResourceExtensions.cs +++ b/Ductus.FluentDocker/Extensions/ResourceExtensions.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using System.Collections.Generic; -using System.IO; using System.Reflection; using Ductus.FluentDocker.Model.Common; using Ductus.FluentDocker.Resources; @@ -97,28 +96,7 @@ public static string ToFile(this EmbeddedUri resource, TemplateString targetPath private static Assembly GetAssembly(string assemblyName) { -#if NETSTANDARD1_6 - return GetAssemblies().First(x => x.GetName().Name == assemblyName); - } - - internal static IEnumerable GetAssemblies() - { - foreach (var library in Microsoft.Extensions.DependencyModel.DependencyContext.Default.RuntimeLibraries) - { - Assembly assembly; - try - { - assembly = Assembly.Load(new AssemblyName(library.Name)); - } - catch (FileNotFoundException) - { - continue; - } - yield return assembly; - } -#else return AppDomain.CurrentDomain.GetAssemblies().First(x => x.GetName().Name == assemblyName); -#endif } } } diff --git a/Ductus.FluentDocker/Resources/ResourceQuery.cs b/Ductus.FluentDocker/Resources/ResourceQuery.cs index a8017f5..af29632 100644 --- a/Ductus.FluentDocker/Resources/ResourceQuery.cs +++ b/Ductus.FluentDocker/Resources/ResourceQuery.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using Ductus.FluentDocker.Extensions; namespace Ductus.FluentDocker.Resources { @@ -33,18 +32,10 @@ public ResourceQuery Recursive() public IEnumerable Query() { -#if NETSTANDARD1_6 - if (string.IsNullOrWhiteSpace(_assembly)) - // TODO : Consider rework of Fluent API - throw new InvalidOperationException($"It is not possible to execute {nameof(Query)} without first executing {nameof(From)}."); - var assembly = ResourceExtensions.GetAssemblies() - .First(x => x.GetName().Name.Equals(_assembly, StringComparison.OrdinalIgnoreCase)); -#else var assembly = string.IsNullOrEmpty(_assembly) ? Assembly.GetCallingAssembly() : AppDomain.CurrentDomain.GetAssemblies() .First(x => x.GetName().Name.Equals(_assembly, StringComparison.OrdinalIgnoreCase)); -#endif var q = assembly.GetManifestResourceNames();