diff --git a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/PatternGroup.cs b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/PatternGroup.cs index ebdc19bdbf..d1c60347ae 100644 --- a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/PatternGroup.cs +++ b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/PatternGroup.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.JsonParser.Sources; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.Dnx.Runtime { diff --git a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/Project.cs b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/Project.cs index e9a610c29c..c0cb19a0b5 100644 --- a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/Project.cs +++ b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/Project.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Versioning; +using Microsoft.Extensions.PlatformAbstractions; using NuGet; namespace Microsoft.Dnx.Runtime diff --git a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/ProjectReader.cs b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/ProjectReader.cs index 0f92fc5bc3..6ad60968dc 100644 --- a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/ProjectReader.cs +++ b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/ProjectReader.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Extensions.JsonParser.Sources; +using Microsoft.Extensions.PlatformAbstractions; using NuGet; namespace Microsoft.Dnx.Runtime diff --git a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/RuntimeEnvironmentHelper.cs b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/RuntimeEnvironmentHelper.cs index 4003c3fee4..27ea21b458 100644 --- a/src/Microsoft.Dnx.Watcher.Core/External/Runtime/RuntimeEnvironmentHelper.cs +++ b/src/Microsoft.Dnx.Watcher.Core/External/Runtime/RuntimeEnvironmentHelper.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.Dnx.Runtime { @@ -18,8 +19,7 @@ namespace Microsoft.Dnx.Runtime private static IRuntimeEnvironment GetRuntimeEnvironment() { - var provider = Infrastructure.CallContextServiceLocator.Locator.ServiceProvider; - var environment = (IRuntimeEnvironment)provider?.GetService(typeof(IRuntimeEnvironment)); + var environment = PlatformServices.Default.Runtime; if (environment == null) { diff --git a/src/Microsoft.Dnx.Watcher.Core/Impl/ProjectProvider.cs b/src/Microsoft.Dnx.Watcher.Core/Impl/ProjectProvider.cs index f7efad6d78..a4c0c7f76c 100644 --- a/src/Microsoft.Dnx.Watcher.Core/Impl/ProjectProvider.cs +++ b/src/Microsoft.Dnx.Watcher.Core/Impl/ProjectProvider.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Dnx.Runtime; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.Dnx.Watcher.Core { diff --git a/src/Microsoft.Dnx.Watcher.Core/project.json b/src/Microsoft.Dnx.Watcher.Core/project.json index 2a9b6ca875..feb354708e 100644 --- a/src/Microsoft.Dnx.Watcher.Core/project.json +++ b/src/Microsoft.Dnx.Watcher.Core/project.json @@ -4,7 +4,7 @@ "dependencies": { "Microsoft.AspNet.FileProviders.Abstractions": "1.0.0-*", "Microsoft.AspNet.FileProviders.Physical": "1.0.0-*", - "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", "Microsoft.Extensions.JsonParser.Sources": { "type": "build", "version": "1.0.0-*" diff --git a/src/Microsoft.Dnx.Watcher/CommandOutputProvider.cs b/src/Microsoft.Dnx.Watcher/CommandOutputProvider.cs index c4b6147600..ea8fec48dd 100644 --- a/src/Microsoft.Dnx.Watcher/CommandOutputProvider.cs +++ b/src/Microsoft.Dnx.Watcher/CommandOutputProvider.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.Dnx.Runtime; +using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.Logging; namespace Microsoft.Dnx.Watcher diff --git a/src/Microsoft.Dnx.Watcher/Program.cs b/src/Microsoft.Dnx.Watcher/Program.cs index 06e2163d5d..e20c5af136 100644 --- a/src/Microsoft.Dnx.Watcher/Program.cs +++ b/src/Microsoft.Dnx.Watcher/Program.cs @@ -6,7 +6,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.Dnx.Runtime; +using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Dnx.Runtime.Common.CommandLine; using Microsoft.Dnx.Watcher.Core; using Microsoft.Extensions.Logging; @@ -19,15 +19,15 @@ namespace Microsoft.Dnx.Watcher private readonly ILoggerFactory _loggerFactory; - public Program(IRuntimeEnvironment runtimeEnvironment) + public Program() { _loggerFactory = new LoggerFactory(); - var commandProvider = new CommandOutputProvider(runtimeEnvironment); + var commandProvider = new CommandOutputProvider(PlatformServices.Default.Runtime); _loggerFactory.AddProvider(commandProvider); } - public int Main(string[] args) + public static int Main(string[] args) { using (CancellationTokenSource ctrlCTokenSource = new CancellationTokenSource()) { @@ -40,7 +40,7 @@ namespace Microsoft.Dnx.Watcher string[] watchArgs, dnxArgs; SeparateWatchArguments(args, out watchArgs, out dnxArgs); - return MainInternal(watchArgs, dnxArgs, ctrlCTokenSource.Token); + return new Program().MainInternal(watchArgs, dnxArgs, ctrlCTokenSource.Token); } } diff --git a/test/Microsoft.Dnx.Watcher.Tests/project.json b/test/Microsoft.Dnx.Watcher.Tests/project.json index fc449ab49d..d093b817ba 100644 --- a/test/Microsoft.Dnx.Watcher.Tests/project.json +++ b/test/Microsoft.Dnx.Watcher.Tests/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", "Microsoft.Dnx.Watcher": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" },