diff --git a/src/Microsoft.DotNet.Watcher.Core/project.json b/src/Microsoft.DotNet.Watcher.Core/project.json index 9b7d46268e..d6c75b463d 100644 --- a/src/Microsoft.DotNet.Watcher.Core/project.json +++ b/src/Microsoft.DotNet.Watcher.Core/project.json @@ -13,15 +13,18 @@ "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", + "NETStandard.Library": "1.5.0-*", "Microsoft.Extensions.Process.Sources": { "type": "build", "version": "1.0.0-*" } }, "frameworks": { - "dnxcore50": { - "imports": "portable-net451+win8" + "netstandard1.5": { + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] } } } diff --git a/src/dotnet-watch/project.json b/src/dotnet-watch/project.json index 1c46b27251..3017b1b110 100644 --- a/src/dotnet-watch/project.json +++ b/src/dotnet-watch/project.json @@ -11,12 +11,20 @@ "Microsoft.DotNet.Watcher.Core": "1.0.0-*", "Microsoft.Extensions.CommandLineUtils": "1.0.0-*", "Microsoft.Extensions.Logging": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*" + "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, "frameworks": { - "dnxcore50": { - "imports": "portable-net451+win8" + "netstandard1.5": { + "imports": [ + "portable-net451+win8", + "dnxcore50" + ], + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + } + } } } } diff --git a/test/TestApps/AppWithDeps/project.json b/test/TestApps/AppWithDeps/project.json index c9ce3f74a3..a102058c92 100644 --- a/test/TestApps/AppWithDeps/project.json +++ b/test/TestApps/AppWithDeps/project.json @@ -3,18 +3,23 @@ "compilationOptions": { "emitEntryPoint": true }, + "dependencies": { - "Dependency": "1.0.0", - "NETStandard.Library": "1.0.0-*" + "Dependency": "1.0.0" }, + "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { - "System.Console": "4.0.0-*", - "System.Diagnostics.Process": "4.1.0-*", - "System.IO": "4.0.11-*", - "System.IO.FileSystem": "4.0.1-*" - } + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + } + }, + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] } } } \ No newline at end of file diff --git a/test/TestApps/Dependency/project.json b/test/TestApps/Dependency/project.json index 89004d9d47..a39c53433e 100644 --- a/test/TestApps/Dependency/project.json +++ b/test/TestApps/Dependency/project.json @@ -1,18 +1,16 @@ { "version": "1.0.0-*", - + "dependencies": { - "NETStandard.Library": "1.0.0-*" + "NETStandard.Library": "1.5.0-*" }, "frameworks": { - "dnxcore50": { - "dependencies": { - "System.Console": "4.0.0-*", - "System.Diagnostics.Process": "4.1.0-*", - "System.IO": "4.0.11-*", - "System.IO.FileSystem": "4.0.1-*" - } + "netstandardapp1.5": { + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] } } } diff --git a/test/TestApps/GlobbingApp/project.json b/test/TestApps/GlobbingApp/project.json index 1a6b3da081..46e1d29d53 100644 --- a/test/TestApps/GlobbingApp/project.json +++ b/test/TestApps/GlobbingApp/project.json @@ -10,18 +10,19 @@ "exclude": [ "exclude/*" ], - "dependencies": { - "NETStandard.Library": "1.0.0-*" - }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { - "System.Console": "4.0.0-*", - "System.Diagnostics.Process": "4.1.0-*", - "System.IO": "4.0.11-*", - "System.IO.FileSystem": "4.0.1-*" - } + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + } + }, + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] } } } diff --git a/test/TestApps/NoDepsApp/project.json b/test/TestApps/NoDepsApp/project.json index 380a03bc97..a01cd35453 100644 --- a/test/TestApps/NoDepsApp/project.json +++ b/test/TestApps/NoDepsApp/project.json @@ -4,18 +4,18 @@ "emitEntryPoint": true }, - "dependencies": { - "NETStandard.Library": "1.0.0-*" - }, - "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { - "System.Console": "4.0.0-*", - "System.Diagnostics.Process": "4.1.0-*", - "System.IO": "4.0.11-*", - "System.IO.FileSystem": "4.0.1-*" - } + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + } + }, + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] } } } diff --git a/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs b/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs index be10d97fbc..22ea8f5cac 100644 --- a/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs +++ b/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs @@ -15,12 +15,14 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests { private const string NugetConfigFileName = "NuGet.config"; + private static readonly object _restoreLock = new object(); + public ProjectToolScenario() { Console.WriteLine($"The temporary test folder is {TempFolder}"); WorkFolder = Path.Combine(TempFolder, "work"); - + CreateTestDirectory(); } @@ -65,7 +67,13 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests Console.WriteLine($"Adding {toolName} to {projectFile}"); var projectJson = JObject.Parse(File.ReadAllText(projectFile)); - projectJson.Add("tools", new JObject(new JProperty(toolName, "1.0.0-*"))); + projectJson.Add("tools", + new JObject( + new JProperty(toolName, + new JObject( + new JProperty("version", "1.0.0-*"), + new JProperty("imports", "portable-net451+win8"))))); + File.WriteAllText(projectFile, projectJson.ToString()); } @@ -80,12 +88,18 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests project = Path.Combine(WorkFolder, project); } - var restore = ExecuteDotnet($"restore -v Minimal", project); - restore.WaitForExit(); - - if (restore.ExitCode != 0) + // Tests are run in parallel and they try to restore tools concurrently. + // This causes issues because the deps json file for a tool is being written from + // multiple threads - which results in either sharing violation or corrupted json. + lock(_restoreLock) { - throw new Exception($"Exit code {restore.ExitCode}"); + var restore = ExecuteDotnet($"restore -v Minimal", project); + restore.WaitForExit(); + + if (restore.ExitCode != 0) + { + throw new Exception($"Exit code {restore.ExitCode}"); + } } } diff --git a/test/dotnet-watch.FunctionalTests/project.json b/test/dotnet-watch.FunctionalTests/project.json index 792bf09599..ce80cc69aa 100644 --- a/test/dotnet-watch.FunctionalTests/project.json +++ b/test/dotnet-watch.FunctionalTests/project.json @@ -11,7 +11,7 @@ "version": "1.0.0-*" }, "Microsoft.DotNet.Watcher.Core": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", + "NETStandard.Library": "1.5.0-*", "Newtonsoft.Json": "8.0.2", "System.Threading.Thread": "4.0.0-*", "xunit": "2.1.0"