From 99371436f3499c28ff25cc62263983ab886c689b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 6 Apr 2016 19:45:38 -0500 Subject: [PATCH 01/13] Consume NETCore.App --- .gitignore | 8 ++- .../project.json | 4 +- .../src/EmptyNetCoreApp/project.json | 2 +- .../project.json | 2 +- .../dotnet-desktop-and-portable/project.json | 2 +- .../TestPackages/dotnet-portable/project.json | 2 +- .../TestAppPortable/project.json | 2 +- .../TestAppPortableDeps/project.json | 2 +- .../PortableTests/PortableApp/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../PortableAppWithNative/project.json | 2 +- .../PortableTests/StandaloneApp/project.json | 2 +- scripts/dotnet-cli-build/CompileTargets.cs | 58 +++++++++++++++---- scripts/dotnet-cli-build/PrepareTargets.cs | 50 ++++++++++++---- scripts/dotnet-cli-build/TestTargets.cs | 15 +++-- .../dotnet-cli-build/Utils/BuildVersion.cs | 1 + scripts/dotnet-cli-build/Utils/Dirs.cs | 1 + scripts/dotnet-cli-build/Utils/JsonUtils.cs | 28 +++++++++ .../update-dependencies/UpdateFilesTargets.cs | 6 +- src/compilers/project.json | 2 +- src/dotnet-compile-fsc/project.json | 2 +- ...json.template => project.json.pretemplate} | 2 +- ...json.template => project.json.pretemplate} | 2 +- src/dotnet/project.json | 2 +- src/sharedframework/framework/project.json | 26 --------- .../framework/project.json.template | 19 ++++++ test/ArgumentForwardingTests/project.json | 2 +- test/ArgumentsReflector/project.json | 2 +- test/EndToEnd/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- test/ScriptExecutorTests/project.json | 2 +- test/dotnet-build.Tests/project.json | 2 +- test/dotnet-compile.Tests/project.json | 2 +- test/dotnet-pack.Tests/project.json | 2 +- .../project.json | 2 +- test/dotnet-publish.Tests/project.json | 2 +- test/dotnet-resgen.Tests/project.json | 2 +- test/dotnet-run.Tests/project.json | 2 +- test/dotnet-test.Tests/project.json | 2 +- test/dotnet-test.UnitTests/project.json | 2 +- test/dotnet.Tests/project.json | 2 +- 46 files changed, 190 insertions(+), 96 deletions(-) create mode 100644 scripts/dotnet-cli-build/Utils/JsonUtils.cs rename src/dotnet/commands/dotnet-new/CSharp_Console/{project.json.template => project.json.pretemplate} (84%) rename src/dotnet/commands/dotnet-new/FSharp_Console/{project.json.template => project.json.pretemplate} (93%) delete mode 100644 src/sharedframework/framework/project.json create mode 100644 src/sharedframework/framework/project.json.template diff --git a/.gitignore b/.gitignore index 7a5b1af63..24c566a59 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,10 @@ cmake/ # stage0 install directory .dotnet_stage0 +# `dotnet new` project.json.template files are generated by a pre-build step. +# ignore these files +/src/dotnet/commands/dotnet-new/**/project.json.template + ### VisualStudio.gitignore from https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore ### ## Ignore Visual Studio temporary files, build results, and @@ -115,10 +119,12 @@ _Chutzpah* ipch/ *.aps *.ncb -*.opensdf *.opendb +*.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess diff --git a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json index 20964ecd1..5e054c559 100644 --- a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json +++ b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json @@ -7,11 +7,11 @@ "dotnet-desktop-and-portable": "1.0.0-*" }, "frameworks": { - "netstandardapp1.5": { + "netstandard1.5": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "imports": [ diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json index 7e4153889..076dcb75b 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Newtonsoft.Json": "8.0.3" } diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json index 0726f91a8..b18b1272f 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*", diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json index 7cfc2e94f..a5c7723d7 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "imports": [ diff --git a/TestAssets/TestPackages/dotnet-portable/project.json b/TestAssets/TestPackages/dotnet-portable/project.json index f04db7245..7e7295a2e 100644 --- a/TestAssets/TestPackages/dotnet-portable/project.json +++ b/TestAssets/TestPackages/dotnet-portable/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json index 7d3d8f139..bcf6d06ad 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json index f761a6c75..864170b2d 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/PortableTests/PortableApp/project.json b/TestAssets/TestProjects/PortableTests/PortableApp/project.json index f86ac470f..932c1708f 100644 --- a/TestAssets/TestProjects/PortableTests/PortableApp/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableApp/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json index 161bcc122..ce4ee1ac2 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json @@ -13,7 +13,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json index 4aea1df3e..1d7079bb6 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "System.Linq": "4.0.0" } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json index 0c76e76d5..ba5c3e08c 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" } diff --git a/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json b/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json index 6398bac17..402647c35 100644 --- a/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json +++ b/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json @@ -9,7 +9,7 @@ "portable-net45+win8" ], "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" + "NETStandard.Library": "1.5.0-rc2-24008" } } }, diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index 6a691db15..cfbf3b1c0 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -49,7 +49,9 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(PrepareTargets.Init), nameof(PackagePkgProjects), nameof(CompileStage1), nameof(CompileStage2))] + // Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the + // Microsoft.NETCore.App package that is created during PackagePkgProjects. + [Target(nameof(PrepareTargets.Init), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))] public static BuildTargetResult Compile(BuildTargetContext c) { return c.Success(); @@ -330,9 +332,26 @@ namespace Microsoft.DotNet.Cli.Build public static void PublishSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli) { - string SharedFrameworkSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); + string SharedFrameworkTemplateSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); string SharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + string sharedFrameworkRid; + if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows) + { + sharedFrameworkRid = $"win7-{PlatformServices.Default.Runtime.RuntimeArchitecture}"; + } + else + { + sharedFrameworkRid = PlatformServices.Default.Runtime.GetRuntimeIdentifier(); + } + + string SharedFrameworkSourceRoot = GenerateSharedFrameworkProject(c, SharedFrameworkTemplateSourceRoot, sharedFrameworkRid); + + dotnetCli.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(SharedFrameworkSourceRoot) + .Execute() + .EnsureSuccessful(); + // We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier. string SharedFrameworkNameAndVersionRoot = Path.Combine(outputDir, "shared", SharedFrameworkName, SharedFrameworkNugetVersion); c.BuildContext["SharedFrameworkPath"] = SharedFrameworkNameAndVersionRoot; @@ -343,19 +362,10 @@ namespace Microsoft.DotNet.Cli.Build } string publishFramework = "dnxcore50"; // Temporary, use "netcoreapp" when we update nuget. - string publishRuntime; - if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows) - { - publishRuntime = $"win7-{PlatformServices.Default.Runtime.RuntimeArchitecture}"; - } - else - { - publishRuntime = PlatformServices.Default.Runtime.GetRuntimeIdentifier(); - } dotnetCli.Publish( "--output", SharedFrameworkNameAndVersionRoot, - "-r", publishRuntime, + "-r", sharedFrameworkRid, "-f", publishFramework, SharedFrameworkSourceRoot).Execute().EnsureSuccessful(); @@ -428,6 +438,30 @@ namespace Microsoft.DotNet.Cli.Build File.WriteAllText(Path.Combine(SharedFrameworkNameAndVersionRoot, ".version"), content); } + /// + /// Generates the real shared framework project that will get published. + /// + /// The "sharedFramework" source template folder. + private static string GenerateSharedFrameworkProject(BuildTargetContext c, string sharedFrameworkTemplatePath, string rid) + { + string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework"); + Utils.DeleteDirectory(sharedFrameworkProjectPath); + CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true); + + string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template"); + JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile); + sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; + ((JObject)sharedFrameworkProject["runtimes"]).RemoveAll(); + sharedFrameworkProject["runtimes"][rid] = new JObject(); + + string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json"); + JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath); + + Rm(templateFile); + + return sharedFrameworkProjectPath; + } + private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir) { var configuration = c.BuildContext.Get("Configuration"); diff --git a/scripts/dotnet-cli-build/PrepareTargets.cs b/scripts/dotnet-cli-build/PrepareTargets.cs index 778bda8b4..d1559421c 100644 --- a/scripts/dotnet-cli-build/PrepareTargets.cs +++ b/scripts/dotnet-cli-build/PrepareTargets.cs @@ -1,23 +1,24 @@ -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.Extensions.PlatformAbstractions; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; - +using System.Text.RegularExpressions; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.Extensions.PlatformAbstractions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; using static Microsoft.DotNet.Cli.Build.FS; using static Microsoft.DotNet.Cli.Build.Utils; -using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; -using System.Text.RegularExpressions; namespace Microsoft.DotNet.Cli.Build { public class PrepareTargets { - [Target(nameof(Init), nameof(RestorePackages))] + [Target(nameof(Init))] public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success(); [Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))] @@ -33,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult CheckInstallerBuildPlatformDependencies(BuildTargetContext c) => c.Success(); // All major targets will depend on this in order to ensure variables are set up right if they are run independently - [Target(nameof(GenerateVersions), nameof(CheckPrereqs), nameof(LocateStage0), nameof(ExpectedBuildArtifacts))] + [Target(nameof(GenerateVersions), nameof(UpdateTemplateVersions), nameof(CheckPrereqs), nameof(LocateStage0), nameof(ExpectedBuildArtifacts))] public static BuildTargetResult Init(BuildTargetContext c) { var runtimeInfo = PlatformServices.Default.Runtime; @@ -82,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Build }; c.BuildContext["BuildVersion"] = buildVersion; c.BuildContext["CommitHash"] = commitHash; - c.BuildContext["SharedFrameworkNugetVersion"] = GetVersionFromProjectJson(Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework", "project.json")); + c.BuildContext["SharedFrameworkNugetVersion"] = buildVersion.NetCoreAppVersion; c.Info($"Building Version: {buildVersion.SimpleVersion} (NuGet Packages: {buildVersion.NuGetVersion})"); c.Info($"From Commit: {commitHash}"); @@ -90,6 +91,27 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } + /// + /// Updates the Microsoft.NETCore.App version number in the `dotnet new` project.json.template files. + /// + [Target] + public static BuildTargetResult UpdateTemplateVersions(BuildTargetContext c) + { + IEnumerable templateFiles = Directory.GetFiles( + Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), + "project.json.pretemplate", + SearchOption.AllDirectories); + + foreach (string templateFile in templateFiles) + { + JObject projectRoot = JsonUtils.ReadProject(templateFile); + projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; + JsonUtils.WriteProject(projectRoot, Path.ChangeExtension(templateFile, "template")); + } + + return c.Success(); + } + [Target] public static BuildTargetResult LocateStage0(BuildTargetContext c) { @@ -206,8 +228,14 @@ namespace Microsoft.DotNet.Cli.Build { var dotnet = DotNetCli.Stage0; - dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes").WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")).Execute().EnsureSuccessful(); - dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes").WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "tools")).Execute().EnsureSuccessful(); + dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) + .Execute() + .EnsureSuccessful(); + dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes") + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "tools")) + .Execute() + .EnsureSuccessful(); return c.Success(); } diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index d99541222..5e394ba1d 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build CleanNuGetTempCache(); var dotnet = DotNetCli.Stage2; - dotnet.Restore("--verbosity", "verbose", "--infer-runtimes") + dotnet.Restore("--verbosity", "verbose", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages")) .Execute() .EnsureSuccessful(); @@ -90,14 +90,16 @@ namespace Microsoft.DotNet.Cli.Build dotnet.Restore( "--verbosity", "verbose", "--infer-runtimes", - "--fallbacksource", Dirs.TestPackages) + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) .Execute().EnsureSuccessful(); // The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output dotnet.Restore( "--verbosity", "verbose", - "--infer-runtimes") + "--infer-runtimes", + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects")) .Execute(); @@ -118,7 +120,8 @@ namespace Microsoft.DotNet.Cli.Build dotnet.Restore("--verbosity", "verbose", "--infer-runtimes", - "--fallbacksource", Dirs.TestPackages) + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects")) .Execute().EnsureSuccessful(); @@ -255,7 +258,9 @@ namespace Microsoft.DotNet.Cli.Build CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test")); CleanNuGetTempCache(); - DotNetCli.Stage2.Restore("--verbosity", "verbose", "--infer-runtimes", "--fallbacksource", Dirs.TestPackages) + DotNetCli.Stage2.Restore("--verbosity", "verbose", + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test")) .Execute() .EnsureSuccessful(); diff --git a/scripts/dotnet-cli-build/Utils/BuildVersion.cs b/scripts/dotnet-cli-build/Utils/BuildVersion.cs index c7e2f50c7..6c10e1ee3 100644 --- a/scripts/dotnet-cli-build/Utils/BuildVersion.cs +++ b/scripts/dotnet-cli-build/Utils/BuildVersion.cs @@ -12,6 +12,7 @@ public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCountString}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; + public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc2-3{CommitCountString}"; public string ProductionVersion => $"{Major}.{Minor}.{Patch}"; public string GenerateMsiVersion() diff --git a/scripts/dotnet-cli-build/Utils/Dirs.cs b/scripts/dotnet-cli-build/Utils/Dirs.cs index cec5db1cb..918f60517 100644 --- a/scripts/dotnet-cli-build/Utils/Dirs.cs +++ b/scripts/dotnet-cli-build/Utils/Dirs.cs @@ -13,6 +13,7 @@ namespace Microsoft.DotNet.Cli.Build "artifacts", PlatformServices.Default.Runtime.GetRuntimeIdentifier()); + public static readonly string Intermediate = Path.Combine(Output, "intermediate"); public static readonly string PackagesIntermediate = Path.Combine(Output, "packages/intermediate"); public static readonly string Packages = Path.Combine(Output, "packages"); public static readonly string Stage1 = Path.Combine(Output, "stage1"); diff --git a/scripts/dotnet-cli-build/Utils/JsonUtils.cs b/scripts/dotnet-cli-build/Utils/JsonUtils.cs new file mode 100644 index 000000000..18fb5b22b --- /dev/null +++ b/scripts/dotnet-cli-build/Utils/JsonUtils.cs @@ -0,0 +1,28 @@ +using System; +using System.IO; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Microsoft.DotNet.Cli.Build +{ + public static class JsonUtils + { + public static JObject ReadProject(string projectJsonPath) + { + using (TextReader projectFileReader = File.OpenText(projectJsonPath)) + { + var projectJsonReader = new JsonTextReader(projectFileReader); + + var serializer = new JsonSerializer(); + return serializer.Deserialize(projectJsonReader); + } + } + + public static void WriteProject(JObject projectRoot, string projectJsonPath) + { + string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented); + + File.WriteAllText(projectJsonPath, projectJson + Environment.NewLine); + } + } +} diff --git a/scripts/update-dependencies/UpdateFilesTargets.cs b/scripts/update-dependencies/UpdateFilesTargets.cs index 93e58fd91..3c59592e2 100644 --- a/scripts/update-dependencies/UpdateFilesTargets.cs +++ b/scripts/update-dependencies/UpdateFilesTargets.cs @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Scripts coreFxLkgVersion = coreFxLkgVersion.Trim(); const string coreFxIdPattern = @"^(?i)((System\..*)|(NETStandard\.Library)|(Microsoft\.CSharp)|(Microsoft\.NETCore.*)|(Microsoft\.TargetingPack\.Private\.(CoreCLR|NETNative))|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))$"; - const string coreFxIdExclusionPattern = @"System.CommandLine"; + const string coreFxIdExclusionPattern = @"System.CommandLine|Microsoft.NETCore.App"; List dependencyInfos = c.GetDependencyInfos(); dependencyInfos.Add(new DependencyInfo() @@ -57,9 +57,7 @@ namespace Microsoft.DotNet.Scripts { List dependencyInfos = c.GetDependencyInfos(); - IEnumerable projectJsonFiles = Enumerable.Union( - Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), - Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)); + IEnumerable projectJsonFiles = Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories); JObject projectRoot; foreach (string projectJsonFile in projectJsonFiles) diff --git a/src/compilers/project.json b/src/compilers/project.json index 64dea980c..0e006bea6 100644 --- a/src/compilers/project.json +++ b/src/compilers/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.CodeAnalysis.CSharp": "1.3.0-beta1-20160405-05", "Microsoft.Net.Compilers.netcore": "1.3.0-beta1-20160405-05", diff --git a/src/dotnet-compile-fsc/project.json b/src/dotnet-compile-fsc/project.json index 786e35418..0e72f2897 100644 --- a/src/dotnet-compile-fsc/project.json +++ b/src/dotnet-compile-fsc/project.json @@ -11,7 +11,7 @@ "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "frameworks": { diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate similarity index 84% rename from src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template rename to src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate index c1c73dfa9..666dee54e 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "$(NetCoreAppVersion)" } }, "frameworks": { diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate similarity index 93% rename from src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template rename to src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate index 492a26337..e527b7159 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template +++ b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate @@ -11,7 +11,7 @@ "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160316", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "$(NetCoreAppVersion)" } }, "tools": { diff --git a/src/dotnet/project.json b/src/dotnet/project.json index 08f102aa5..72c39425c 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -41,7 +41,7 @@ "Microsoft.NETCore.TestHost": "1.0.0-rc2-24008", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-24008", diff --git a/src/sharedframework/framework/project.json b/src/sharedframework/framework/project.json deleted file mode 100644 index 6d9bc2088..000000000 --- a/src/sharedframework/framework/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" - }, - "runtimes": { - "win7-x64": {}, - "win7-x86": {}, - "osx.10.10-x64": {}, - "osx.10.11-x64": {}, - "ubuntu.14.04-x64": {}, - "centos.7-x64": {}, - "rhel.7.2-x64": {}, - "debian.8.2-x64": {} - }, - "frameworks": { - "dnxcore50": { - "imports": [ - "portable-net45+win8" - ] - } - } -} diff --git a/src/sharedframework/framework/project.json.template b/src/sharedframework/framework/project.json.template new file mode 100644 index 000000000..fde657ccc --- /dev/null +++ b/src/sharedframework/framework/project.json.template @@ -0,0 +1,19 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + "dependencies": { + "Microsoft.NETCore.App": "$(NetCoreAppVersion)" + }, + "runtimes": { + "$(RID)": {} + }, + "frameworks": { + "dnxcore50": { + "imports": [ + "portable-net45+win8" + ] + } + } +} diff --git a/test/ArgumentForwardingTests/project.json b/test/ArgumentForwardingTests/project.json index 7cfded314..48d686660 100644 --- a/test/ArgumentForwardingTests/project.json +++ b/test/ArgumentForwardingTests/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/ArgumentsReflector/project.json b/test/ArgumentsReflector/project.json index 37f50ec47..6762af944 100644 --- a/test/ArgumentsReflector/project.json +++ b/test/ArgumentsReflector/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" + "Microsoft.NETCore.App": "1.0.0-rc2-*" }, "frameworks": { "netstandardapp1.5": { diff --git a/test/EndToEnd/project.json b/test/EndToEnd/project.json index 7f147431e..5f372543a 100644 --- a/test/EndToEnd/project.json +++ b/test/EndToEnd/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 4a48665fb..6f30484c5 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1130", diff --git a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json index 396dc3c1a..e9f279f08 100644 --- a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json +++ b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/project.json b/test/Microsoft.DotNet.ProjectModel.Tests/project.json index ed31f5e14..446f872d4 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/project.json +++ b/test/Microsoft.DotNet.ProjectModel.Tests/project.json @@ -4,7 +4,7 @@ "keyFile": "../../tools/test_key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json index 71542fac1..fba3d1fb5 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json @@ -5,7 +5,7 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Collections.Immutable": "1.2.0-rc2-24008", "System.Net.NetworkInformation": "4.1.0-rc2-24008", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index 2393ecc24..c1cd852fa 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -5,7 +5,7 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, diff --git a/test/ScriptExecutorTests/project.json b/test/ScriptExecutorTests/project.json index d72919c8a..9b0dc4a13 100644 --- a/test/ScriptExecutorTests/project.json +++ b/test/ScriptExecutorTests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Microsoft.DotNet.ProjectModel": { "target": "project" }, diff --git a/test/dotnet-build.Tests/project.json b/test/dotnet-build.Tests/project.json index bb86ad070..fd2d4eb9d 100644 --- a/test/dotnet-build.Tests/project.json +++ b/test/dotnet-build.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-compile.Tests/project.json b/test/dotnet-compile.Tests/project.json index bb5d589c0..de84dfc87 100644 --- a/test/dotnet-compile.Tests/project.json +++ b/test/dotnet-compile.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-pack.Tests/project.json b/test/dotnet-pack.Tests/project.json index 6afeb6cbc..30ce4fea7 100644 --- a/test/dotnet-pack.Tests/project.json +++ b/test/dotnet-pack.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.IO.Compression.ZipFile": "4.0.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-projectmodel-server.Tests/project.json b/test/dotnet-projectmodel-server.Tests/project.json index db79a5cdc..af5615ef9 100644 --- a/test/dotnet-projectmodel-server.Tests/project.json +++ b/test/dotnet-projectmodel-server.Tests/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "dotnet": { "target": "project" }, diff --git a/test/dotnet-publish.Tests/project.json b/test/dotnet-publish.Tests/project.json index 546719974..b8ebd4eef 100644 --- a/test/dotnet-publish.Tests/project.json +++ b/test/dotnet-publish.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.TestFramework": "1.0.0-*", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-resgen.Tests/project.json b/test/dotnet-resgen.Tests/project.json index ebb353742..a305b46f1 100644 --- a/test/dotnet-resgen.Tests/project.json +++ b/test/dotnet-resgen.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-run.Tests/project.json b/test/dotnet-run.Tests/project.json index 29ca2db06..416e8b721 100644 --- a/test/dotnet-run.Tests/project.json +++ b/test/dotnet-run.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-test.Tests/project.json b/test/dotnet-test.Tests/project.json index dcaec7496..26eae31c5 100644 --- a/test/dotnet-test.Tests/project.json +++ b/test/dotnet-test.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Newtonsoft.Json": "7.0.1", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 068385484..679ee4215 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Newtonsoft.Json": "7.0.1", "dotnet": { "target": "project" diff --git a/test/dotnet.Tests/project.json b/test/dotnet.Tests/project.json index 7342ee11c..21eaff1f5 100644 --- a/test/dotnet.Tests/project.json +++ b/test/dotnet.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" From 6ae044e5e19661c635d141fb8f1444cf0045e43b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 15:06:11 -0500 Subject: [PATCH 02/13] Fix non-windows builds of Microsoft.NETCore.App. Fix all test project.jsons to be portable apps. --- pkg/pack.sh | 2 +- .../Microsoft.NETCore.App.builds | 2 +- scripts/dotnet-cli-build/PrepareTargets.cs | 2 +- test/ArgumentForwardingTests/project.json | 10 +++++++--- test/ArgumentsReflector/project.json | 12 +++++++++--- test/EndToEnd/project.json | 8 ++++++-- test/Kestrel.Tests/project.json | 8 ++++++-- test/Microsoft.DotNet.Cli.Utils.Tests/project.json | 8 ++++++-- .../project.json | 8 ++++++-- .../Microsoft.DotNet.ProjectModel.Tests/project.json | 8 ++++++-- .../project.json | 8 ++++++-- .../project.json | 8 ++++++-- test/ScriptExecutorTests/project.json | 8 ++++++-- .../project.json | 8 ++++++-- .../project.json | 8 ++++++-- test/dotnet-build.Tests/project.json | 8 ++++++-- test/dotnet-compile-fsc.Tests/project.json | 8 ++++++-- test/dotnet-compile.Tests/project.json | 8 ++++++-- test/dotnet-compile.UnitTests/project.json | 7 ++++++- test/dotnet-pack.Tests/project.json | 8 ++++++-- test/dotnet-projectmodel-server.Tests/project.json | 8 ++++++-- test/dotnet-publish.Tests/project.json | 8 ++++++-- test/dotnet-resgen.Tests/project.json | 8 ++++++-- test/dotnet-run.Tests/project.json | 8 ++++++-- test/dotnet-test.Tests/project.json | 8 ++++++-- test/dotnet-test.UnitTests/project.json | 8 ++++++-- test/dotnet.Tests/project.json | 8 ++++++-- 27 files changed, 151 insertions(+), 52 deletions(-) diff --git a/pkg/pack.sh b/pkg/pack.sh index c7b67b407..70c1ff17d 100755 --- a/pkg/pack.sh +++ b/pkg/pack.sh @@ -116,7 +116,7 @@ else init_distro_name fi -__common_parameters="/p:Platform=$__build_arch /p:DotNetHostBinDir=$__dotnet_host_bin_dir /p:$__targets_param /p:DistroName=$__distro_name /p:HostVersion=$__host_ver /p:HostResolverVersion=$__fxr_ver /p:HostPolicyVersion=$__policy_ver /p:BuildNumberMajor=$__build_major /p:PreReleaseLabel=$__version_tag /verbosity:minimal" +__common_parameters="/p:Platform=$__build_arch /p:DotNetHostBinDir=$__dotnet_host_bin_dir /p:$__targets_param /p:DistroName=$__distro_name /p:HostVersion=$__host_ver /p:HostResolverVersion=$__fxr_ver /p:HostPolicyVersion=$__policy_ver /p:BuildNumberMajor=$__build_major /p:PreReleaseLabel=$__version_tag /p:CLIBuildVersion=$__build_major /verbosity:minimal" $__corerun $__msbuild $__project_dir/projects/packages.builds $__common_parameters || exit 1 diff --git a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds b/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds index 191f03d92..be7a99d55 100644 --- a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds +++ b/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds @@ -3,7 +3,7 @@ - + diff --git a/scripts/dotnet-cli-build/PrepareTargets.cs b/scripts/dotnet-cli-build/PrepareTargets.cs index d1559421c..56c06a8e6 100644 --- a/scripts/dotnet-cli-build/PrepareTargets.cs +++ b/scripts/dotnet-cli-build/PrepareTargets.cs @@ -98,7 +98,7 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult UpdateTemplateVersions(BuildTargetContext c) { IEnumerable templateFiles = Directory.GetFiles( - Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), + Path.Combine(Dirs.RepoRoot, "src", "dotnet", "commands", "dotnet-new"), "project.json.pretemplate", SearchOption.AllDirectories); diff --git a/test/ArgumentForwardingTests/project.json b/test/ArgumentForwardingTests/project.json index 48d686660..2d4b62d86 100644 --- a/test/ArgumentForwardingTests/project.json +++ b/test/ArgumentForwardingTests/project.json @@ -4,7 +4,10 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" @@ -19,8 +22,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] @@ -28,6 +32,6 @@ }, "testRunner": "xunit", "scripts": { - "precompile": "dotnet publish ../ArgumentsReflector/project.json --framework netstandardapp1.5 --runtime %compile:RuntimeIdentifier% --output %compile:RuntimeOutputDir%" + "precompile": "dotnet publish ../ArgumentsReflector/project.json --framework netcoreapp1.0 --runtime %compile:RuntimeIdentifier% --output %compile:RuntimeOutputDir%" } } diff --git a/test/ArgumentsReflector/project.json b/test/ArgumentsReflector/project.json index 6762af944..323a45c38 100644 --- a/test/ArgumentsReflector/project.json +++ b/test/ArgumentsReflector/project.json @@ -4,11 +4,17 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*" + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, }, "frameworks": { - "netstandardapp1.5": { - "imports": "dnxcore50" + "netcoreapp1.0": { + "imports": [ + "netstandardapp1.5", + "dnxcore50" + ] } }, "content": [ diff --git a/test/EndToEnd/project.json b/test/EndToEnd/project.json index 5f372543a..8fb91025c 100644 --- a/test/EndToEnd/project.json +++ b/test/EndToEnd/project.json @@ -4,7 +4,10 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" @@ -20,8 +23,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Kestrel.Tests/project.json b/test/Kestrel.Tests/project.json index 29ca2db06..fd6049834 100644 --- a/test/Kestrel.Tests/project.json +++ b/test/Kestrel.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -13,8 +16,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 6f30484c5..ad3672022 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -4,7 +4,10 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1130", @@ -24,8 +27,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json index e9f279f08..29a31346c 100644 --- a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json +++ b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -16,8 +19,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/project.json b/test/Microsoft.DotNet.ProjectModel.Tests/project.json index 446f872d4..1f4446a02 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/project.json +++ b/test/Microsoft.DotNet.ProjectModel.Tests/project.json @@ -4,7 +4,10 @@ "keyFile": "../../tools/test_key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" @@ -16,8 +19,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json index fba3d1fb5..8071d7a8b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json @@ -5,7 +5,10 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Collections.Immutable": "1.2.0-rc2-24008", "System.Net.NetworkInformation": "4.1.0-rc2-24008", @@ -22,8 +25,9 @@ } }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index c1cd852fa..4748b9cc5 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -5,7 +5,10 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, @@ -18,8 +21,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/ScriptExecutorTests/project.json b/test/ScriptExecutorTests/project.json index 9b0dc4a13..43d6c55ee 100644 --- a/test/ScriptExecutorTests/project.json +++ b/test/ScriptExecutorTests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.DotNet.ProjectModel": { "target": "project" }, @@ -15,8 +18,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json index 25d18f4c3..957fb9aaf 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.Extensions.Testing.Abstractions": { "target": "project" }, @@ -20,8 +23,9 @@ "FluentAssertions": "4.2.2" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "netstandard1.3", "portable-net45+win8" diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json index fd1f9dc30..daeca28df 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.Extensions.Testing.Abstractions": { "target": "project" }, @@ -16,8 +19,9 @@ "moq.netcore": "4.4.0-beta8" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "netstandard1.3", "portable-net45+win8" diff --git a/test/dotnet-build.Tests/project.json b/test/dotnet-build.Tests/project.json index fd2d4eb9d..d83d58ec5 100644 --- a/test/dotnet-build.Tests/project.json +++ b/test/dotnet-build.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -14,8 +17,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net451+win8" ] diff --git a/test/dotnet-compile-fsc.Tests/project.json b/test/dotnet-compile-fsc.Tests/project.json index 37052a95b..9666544c5 100644 --- a/test/dotnet-compile-fsc.Tests/project.json +++ b/test/dotnet-compile-fsc.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, @@ -12,8 +15,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net451+win8" ] diff --git a/test/dotnet-compile.Tests/project.json b/test/dotnet-compile.Tests/project.json index de84dfc87..2f034648f 100644 --- a/test/dotnet-compile.Tests/project.json +++ b/test/dotnet-compile.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -13,8 +16,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net451+win8" ] diff --git a/test/dotnet-compile.UnitTests/project.json b/test/dotnet-compile.UnitTests/project.json index 9d22b2777..096b4ec0f 100644 --- a/test/dotnet-compile.UnitTests/project.json +++ b/test/dotnet-compile.UnitTests/project.json @@ -4,6 +4,10 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Microsoft.DotNet.Cli.Utils": { "target": "project" }, @@ -26,8 +30,9 @@ "FluentAssertions": "4.2.2" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net451+win8" ] diff --git a/test/dotnet-pack.Tests/project.json b/test/dotnet-pack.Tests/project.json index 30ce4fea7..772f6dd96 100644 --- a/test/dotnet-pack.Tests/project.json +++ b/test/dotnet-pack.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.IO.Compression.ZipFile": "4.0.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { @@ -14,8 +17,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net451+win8" ] diff --git a/test/dotnet-projectmodel-server.Tests/project.json b/test/dotnet-projectmodel-server.Tests/project.json index af5615ef9..b735699a9 100644 --- a/test/dotnet-projectmodel-server.Tests/project.json +++ b/test/dotnet-projectmodel-server.Tests/project.json @@ -1,6 +1,9 @@ { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "dotnet": { "target": "project" }, @@ -19,8 +22,9 @@ "System.Net.NameResolution": "4.0.0-rc2-24008" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet-publish.Tests/project.json b/test/dotnet-publish.Tests/project.json index b8ebd4eef..a3335d0ae 100644 --- a/test/dotnet-publish.Tests/project.json +++ b/test/dotnet-publish.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.TestFramework": "1.0.0-*", "Microsoft.DotNet.Tools.Tests.Utilities": { @@ -15,8 +18,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet-resgen.Tests/project.json b/test/dotnet-resgen.Tests/project.json index a305b46f1..137f9d4b3 100644 --- a/test/dotnet-resgen.Tests/project.json +++ b/test/dotnet-resgen.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -14,8 +17,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet-run.Tests/project.json b/test/dotnet-run.Tests/project.json index 416e8b721..fd6049834 100644 --- a/test/dotnet-run.Tests/project.json +++ b/test/dotnet-run.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -13,8 +16,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet-test.Tests/project.json b/test/dotnet-test.Tests/project.json index 26eae31c5..8a463be26 100644 --- a/test/dotnet-test.Tests/project.json +++ b/test/dotnet-test.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Newtonsoft.Json": "7.0.1", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -19,8 +22,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 679ee4215..9625d96de 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "Newtonsoft.Json": "7.0.1", "dotnet": { "target": "project" @@ -16,8 +19,9 @@ "FluentAssertions": "4.2.2" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/test/dotnet.Tests/project.json b/test/dotnet.Tests/project.json index 21eaff1f5..233e3f343 100644 --- a/test/dotnet.Tests/project.json +++ b/test/dotnet.Tests/project.json @@ -1,7 +1,10 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" @@ -17,8 +20,9 @@ "dotnet-test-xunit": "1.0.0-dev-128011-22" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] From 6fa859a354c9c380b1b0f753df5f0348d2d68acd Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 16:37:51 -0500 Subject: [PATCH 03/13] Fix ProjectDependenciesCommandResolver for portable test apps. Update to dotnet-test-xunit to latest. --- .../ProjectDependenciesCommandResolver.cs | 8 +------- test/ArgumentForwardingTests/project.json | 2 +- test/EndToEnd/project.json | 2 +- test/Kestrel.Tests/project.json | 2 +- test/Microsoft.DotNet.Cli.Utils.Tests/project.json | 2 +- test/Microsoft.DotNet.Compiler.Common.Tests/project.json | 2 +- test/Microsoft.DotNet.ProjectModel.Tests/project.json | 2 +- test/Microsoft.DotNet.Tools.Tests.Utilities/project.json | 2 +- .../project.json | 2 +- test/ScriptExecutorTests/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- test/dotnet-build.Tests/project.json | 2 +- test/dotnet-compile-fsc.Tests/project.json | 2 +- test/dotnet-compile.Tests/project.json | 2 +- test/dotnet-compile.UnitTests/project.json | 2 +- test/dotnet-pack.Tests/project.json | 2 +- test/dotnet-projectmodel-server.Tests/project.json | 2 +- test/dotnet-publish.Tests/project.json | 2 +- test/dotnet-resgen.Tests/project.json | 2 +- test/dotnet-run.Tests/project.json | 2 +- test/dotnet-test.Tests/project.json | 2 +- test/dotnet-test.UnitTests/project.json | 2 +- test/dotnet.Tests/project.json | 2 +- 24 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs index 921561690..232fba1b1 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs @@ -132,17 +132,11 @@ namespace Microsoft.DotNet.Cli.Utils return null; } - var projectContext = ProjectContext.Create( + return ProjectContext.Create( projectRootPath, framework, PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); - if (projectContext.RuntimeIdentifier == null) - { - return null; - } - - return projectContext; } private IEnumerable GetAllowedCommandExtensionsFromEnvironment(IEnvironmentProvider environment) diff --git a/test/ArgumentForwardingTests/project.json b/test/ArgumentForwardingTests/project.json index 2d4b62d86..b986741f7 100644 --- a/test/ArgumentForwardingTests/project.json +++ b/test/ArgumentForwardingTests/project.json @@ -19,7 +19,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/EndToEnd/project.json b/test/EndToEnd/project.json index 8fb91025c..db275ed3a 100644 --- a/test/EndToEnd/project.json +++ b/test/EndToEnd/project.json @@ -20,7 +20,7 @@ }, "xunit": "2.1.0", "xunit.netcore.extensions": "1.0.0-prerelease-00206", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/Kestrel.Tests/project.json b/test/Kestrel.Tests/project.json index fd6049834..9ca778b94 100644 --- a/test/Kestrel.Tests/project.json +++ b/test/Kestrel.Tests/project.json @@ -13,7 +13,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index ad3672022..6eacbd4e1 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -24,7 +24,7 @@ }, "moq.netcore": "4.4.0-beta8", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json index 29a31346c..72bab1eb2 100644 --- a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json +++ b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json @@ -16,7 +16,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/project.json b/test/Microsoft.DotNet.ProjectModel.Tests/project.json index 1f4446a02..df289bc0a 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/project.json +++ b/test/Microsoft.DotNet.ProjectModel.Tests/project.json @@ -16,7 +16,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json index 8071d7a8b..357c6fdc4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json @@ -14,7 +14,7 @@ "System.Net.NetworkInformation": "4.1.0-rc2-24008", "FluentAssertions": "4.0.0", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "Microsoft.DotNet.TestFramework": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index 4748b9cc5..1ead922b7 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -18,7 +18,7 @@ "FluentAssertions": "4.0.0", "moq.netcore": "4.4.0-beta8", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/ScriptExecutorTests/project.json b/test/ScriptExecutorTests/project.json index 43d6c55ee..dfbbc6aa0 100644 --- a/test/ScriptExecutorTests/project.json +++ b/test/ScriptExecutorTests/project.json @@ -15,7 +15,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json index 957fb9aaf..11d6d9ca9 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json @@ -19,7 +19,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "FluentAssertions": "4.2.2" }, "frameworks": { diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json index daeca28df..800d35eb3 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json @@ -14,7 +14,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "FluentAssertions": "4.2.2", "moq.netcore": "4.4.0-beta8" }, diff --git a/test/dotnet-build.Tests/project.json b/test/dotnet-build.Tests/project.json index d83d58ec5..82c99f5ca 100644 --- a/test/dotnet-build.Tests/project.json +++ b/test/dotnet-build.Tests/project.json @@ -14,7 +14,7 @@ }, "Newtonsoft.Json": "7.0.1", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-compile-fsc.Tests/project.json b/test/dotnet-compile-fsc.Tests/project.json index 9666544c5..b9deca2f2 100644 --- a/test/dotnet-compile-fsc.Tests/project.json +++ b/test/dotnet-compile-fsc.Tests/project.json @@ -12,7 +12,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-compile.Tests/project.json b/test/dotnet-compile.Tests/project.json index 2f034648f..5d085f42f 100644 --- a/test/dotnet-compile.Tests/project.json +++ b/test/dotnet-compile.Tests/project.json @@ -13,7 +13,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-compile.UnitTests/project.json b/test/dotnet-compile.UnitTests/project.json index 096b4ec0f..cf7ba2256 100644 --- a/test/dotnet-compile.UnitTests/project.json +++ b/test/dotnet-compile.UnitTests/project.json @@ -25,7 +25,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "moq.netcore": "4.4.0-beta8", "FluentAssertions": "4.2.2" }, diff --git a/test/dotnet-pack.Tests/project.json b/test/dotnet-pack.Tests/project.json index 772f6dd96..54658e1e4 100644 --- a/test/dotnet-pack.Tests/project.json +++ b/test/dotnet-pack.Tests/project.json @@ -14,7 +14,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-projectmodel-server.Tests/project.json b/test/dotnet-projectmodel-server.Tests/project.json index b735699a9..74d08e236 100644 --- a/test/dotnet-projectmodel-server.Tests/project.json +++ b/test/dotnet-projectmodel-server.Tests/project.json @@ -18,7 +18,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "System.Net.NameResolution": "4.0.0-rc2-24008" }, "frameworks": { diff --git a/test/dotnet-publish.Tests/project.json b/test/dotnet-publish.Tests/project.json index a3335d0ae..6a50d1868 100644 --- a/test/dotnet-publish.Tests/project.json +++ b/test/dotnet-publish.Tests/project.json @@ -15,7 +15,7 @@ }, "xunit": "2.1.0", "xunit.netcore.extensions": "1.0.0-prerelease-00206", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-resgen.Tests/project.json b/test/dotnet-resgen.Tests/project.json index 137f9d4b3..edc239ac1 100644 --- a/test/dotnet-resgen.Tests/project.json +++ b/test/dotnet-resgen.Tests/project.json @@ -14,7 +14,7 @@ }, "xunit": "2.1.0", "xunit.netcore.extensions": "1.0.0-prerelease-00206", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-run.Tests/project.json b/test/dotnet-run.Tests/project.json index fd6049834..9ca778b94 100644 --- a/test/dotnet-run.Tests/project.json +++ b/test/dotnet-run.Tests/project.json @@ -13,7 +13,7 @@ "target": "project" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-test.Tests/project.json b/test/dotnet-test.Tests/project.json index 8a463be26..ab6996c68 100644 --- a/test/dotnet-test.Tests/project.json +++ b/test/dotnet-test.Tests/project.json @@ -19,7 +19,7 @@ "System.Net.Sockets": "4.1.0-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 9625d96de..bcc16494a 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -14,7 +14,7 @@ "exclude": "Compile" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22", + "dotnet-test-xunit": "1.0.0-dev-140469-38", "moq.netcore": "4.4.0-beta8", "FluentAssertions": "4.2.2" }, diff --git a/test/dotnet.Tests/project.json b/test/dotnet.Tests/project.json index 233e3f343..c9e207c14 100644 --- a/test/dotnet.Tests/project.json +++ b/test/dotnet.Tests/project.json @@ -17,7 +17,7 @@ "type": "build" }, "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { "netcoreapp1.0": { From 34d24459161e9dfe6fd8fa50e268c7eefcc83d50 Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Thu, 7 Apr 2016 16:20:51 -0700 Subject: [PATCH 04/13] Add --runtimeconfig to the hostfxr, and use this option for the xunit scenario. --- .../IPackagedCommandSpecFactory.cs | 3 +- .../PackagedCommandSpecFactory.cs | 32 +++++++++++++------ .../ProjectDependenciesCommandResolver.cs | 23 +++---------- .../ProjectToolsCommandResolver.cs | 3 +- src/corehost/cli/fxr/fx_muxer.cpp | 12 +++++-- src/corehost/cli/hostpolicy.cpp | 8 +++-- src/corehost/cli/libhost.cpp | 7 ++-- src/corehost/cli/libhost.h | 2 +- 8 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs index 61990262f..3c5316456 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs @@ -17,7 +17,8 @@ namespace Microsoft.DotNet.Cli.Utils IEnumerable allowedExtensions, string nugetPackagesRoot, CommandResolutionStrategy commandResolutionStrategy, - string depsFilePath); + string depsFilePath, + string runtimeConfigPath); } } diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs index 93268b293..ae10b4812 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs @@ -17,7 +17,8 @@ namespace Microsoft.DotNet.Cli.Utils IEnumerable allowedExtensions, string nugetPackagesRoot, CommandResolutionStrategy commandResolutionStrategy, - string depsFilePath) + string depsFilePath, + string runtimeConfigPath) { var toolAssembly = toolLibrary?.RuntimeAssemblies @@ -35,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Utils return null; } - var isPortable = IsPortableApp(commandPath); + var isPortable = IsPortableApp(commandPath, runtimeConfigPath); return CreateCommandSpecWrappingWithCorehostIfDll( commandPath, @@ -43,7 +44,8 @@ namespace Microsoft.DotNet.Cli.Utils depsFilePath, commandResolutionStrategy, nugetPackagesRoot, - isPortable); + isPortable, + runtimeConfigPath); } private string GetCommandFilePath(string nugetPackagesRoot, LockFileTargetLibrary toolLibrary, LockFileItem runtimeAssembly) @@ -62,7 +64,8 @@ namespace Microsoft.DotNet.Cli.Utils string depsFilePath, CommandResolutionStrategy commandResolutionStrategy, string nugetPackagesRoot, - bool isPortable) + bool isPortable, + string runtimeConfigPath) { var commandExtension = Path.GetExtension(commandPath); @@ -74,7 +77,8 @@ namespace Microsoft.DotNet.Cli.Utils depsFilePath, commandResolutionStrategy, nugetPackagesRoot, - isPortable); + isPortable, + runtimeConfigPath); } return CreateCommandSpec(commandPath, commandArguments, commandResolutionStrategy); @@ -86,7 +90,8 @@ namespace Microsoft.DotNet.Cli.Utils string depsFilePath, CommandResolutionStrategy commandResolutionStrategy, string nugetPackagesRoot, - bool isPortable) + bool isPortable, + string runtimeConfigPath) { var host = string.Empty; var arguments = new List(); @@ -110,6 +115,12 @@ namespace Microsoft.DotNet.Cli.Utils arguments.Add(commandPath); + if (runtimeConfigPath != null) + { + arguments.Add("--runtimeconfig"); + arguments.Add(runtimeConfigPath); + } + if (depsFilePath != null) { arguments.Add("--depsfile"); @@ -134,13 +145,14 @@ namespace Microsoft.DotNet.Cli.Utils return new CommandSpec(commandPath, escapedArgs, commandResolutionStrategy); } - private bool IsPortableApp(string commandPath) + private bool IsPortableApp(string commandPath, string runtimeConfigPath) { var commandDir = Path.GetDirectoryName(commandPath); - var runtimeConfigPath = Directory.EnumerateFiles(commandDir) - .FirstOrDefault(x => x.EndsWith("runtimeconfig.json")); - + runtimeConfigPath = string.IsNullOrEmpty(runtimeConfigPath) + ? Directory.EnumerateFiles(commandDir).FirstOrDefault(x => x.EndsWith("runtimeconfig.json")) + : runtimeConfigPath; + if (runtimeConfigPath == null) { return false; diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs index 232fba1b1..b1c356d26 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs @@ -78,25 +78,11 @@ namespace Microsoft.DotNet.Cli.Utils var depsFilePath = projectContext.GetOutputPaths(configuration, buildBasePath, outputPath).RuntimeFiles.DepsJson; + var runtimeConfigPath = + projectContext.GetOutputPaths(configuration, buildBasePath, outputPath).RuntimeFiles.RuntimeConfigJson; + var toolLibrary = GetToolLibraryForContext(projectContext, commandName); - return ResolveFromDependencyLibrary( - toolLibrary, - depsFilePath, - commandName, - allowedExtensions, - commandArguments, - projectContext); - } - - private CommandSpec ResolveFromDependencyLibrary( - LockFileTargetLibrary toolLibrary, - string depsFilePath, - string commandName, - IEnumerable allowedExtensions, - IEnumerable commandArguments, - ProjectContext projectContext) - { return _packagedCommandSpecFactory.CreateCommandSpecFromLibrary( toolLibrary, commandName, @@ -104,7 +90,8 @@ namespace Microsoft.DotNet.Cli.Utils allowedExtensions, projectContext.PackagesDirectory, s_commandResolutionStrategy, - depsFilePath); + depsFilePath, + runtimeConfigPath); } private LockFileTargetLibrary GetToolLibraryForContext( diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index a510aa9fa..57ffb8290 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -123,7 +123,8 @@ namespace Microsoft.DotNet.Cli.Utils _allowedCommandExtensions, projectContext.PackagesDirectory, s_commandResolutionStrategy, - depsFilePath); + depsFilePath, + null); } private LockFile GetToolLockFile( diff --git a/src/corehost/cli/fxr/fx_muxer.cpp b/src/corehost/cli/fxr/fx_muxer.cpp index 4164d32d6..1ddb5ef13 100644 --- a/src/corehost/cli/fxr/fx_muxer.cpp +++ b/src/corehost/cli/fxr/fx_muxer.cpp @@ -304,15 +304,21 @@ int fx_muxer_t::parse_args_and_execute(const pal::string_t& own_dir, int argoff, pal::string_t opts_deps_file = _X("--depsfile"); pal::string_t opts_probe_path = _X("--additionalprobingpath"); + pal::string_t opts_runtime_config = _X("--runtimeconfig"); + pal::string_t deps_file = get_last_known_arg(opts, opts_deps_file, _X("")); + pal::string_t runtime_config = get_last_known_arg(opts, opts_runtime_config, _X("")); std::vector probe_paths = opts.count(opts_probe_path) ? opts[opts_probe_path] : std::vector(); trace::verbose(_X("Current argv is %s"), app_candidate.c_str()); pal::string_t app_or_deps = deps_file.empty() ? app_candidate : deps_file; - pal::string_t no_json = app_candidate; - pal::string_t dev_config_file; - auto config_file = get_runtime_config_from_file(no_json, &dev_config_file); + pal::string_t app_or_runtime_config = runtime_config.empty() ? app_candidate : runtime_config; + pal::string_t config_file, dev_config_file; + + trace::error(_X("Finding runtimeconfig.json from [%s]"), app_or_runtime_config.c_str()); + get_runtime_config_paths_from_file(app_or_runtime_config, &config_file, &dev_config_file); + runtime_config_t config(config_file, dev_config_file); for (const auto& path : config.get_probe_paths()) { diff --git a/src/corehost/cli/hostpolicy.cpp b/src/corehost/cli/hostpolicy.cpp index 795439f75..6349e7ce3 100644 --- a/src/corehost/cli/hostpolicy.cpp +++ b/src/corehost/cli/hostpolicy.cpp @@ -246,9 +246,11 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[]) } else { - pal::string_t dev_config_file; - auto config_path = get_runtime_config_from_file(args.managed_application, &dev_config_file); - runtime_config_t config(config_path, dev_config_file); + pal::string_t config_file, dev_config_file; + + get_runtime_config_paths_from_file(args.managed_application, &config_file, &dev_config_file); + runtime_config_t config(config_file, dev_config_file); + if (!config.is_valid()) { trace::error(_X("Invalid runtimeconfig.json [%s] [%s]"), config.get_path().c_str(), config.get_dev_path().c_str()); diff --git a/src/corehost/cli/libhost.cpp b/src/corehost/cli/libhost.cpp index fa398b825..a97c8ff19 100644 --- a/src/corehost/cli/libhost.cpp +++ b/src/corehost/cli/libhost.cpp @@ -6,20 +6,23 @@ #include "trace.h" #include "libhost.h" -pal::string_t get_runtime_config_from_file(const pal::string_t& file, pal::string_t* dev_cfg) +void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* cfg, pal::string_t* dev_cfg) { auto name = get_filename_without_ext(file); + auto json_name = name + _X(".runtimeconfig.json"); auto dev_json_name = name + _X(".runtimeconfig.dev.json"); + auto json_path = get_directory(file); auto dev_json_path = json_path; append_path(&json_path, json_name.c_str()); append_path(&dev_json_path, dev_json_name.c_str()); + trace::verbose(_X("Runtime config is cfg=%s dev=%s"), json_path.c_str(), dev_json_path.c_str()); dev_cfg->assign(dev_json_path); - return json_path; + cfg -> assign(json_path); } host_mode_t detect_operating_mode(const int argc, const pal::char_t* argv[], pal::string_t* p_own_dir) diff --git a/src/corehost/cli/libhost.h b/src/corehost/cli/libhost.h index 220901372..27b29acf7 100644 --- a/src/corehost/cli/libhost.h +++ b/src/corehost/cli/libhost.h @@ -80,7 +80,7 @@ public: } }; -pal::string_t get_runtime_config_from_file(const pal::string_t& file, pal::string_t* dev_config_file); +void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); host_mode_t detect_operating_mode(const int argc, const pal::char_t* argv[], pal::string_t* own_dir = nullptr); void try_patch_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str); From 1f5116addf67c332e3577d9ca76abb3fb4e4e259 Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Thu, 7 Apr 2016 16:36:04 -0700 Subject: [PATCH 05/13] add --runtimeconfig to known opts --- src/corehost/cli/fxr/fx_muxer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corehost/cli/fxr/fx_muxer.cpp b/src/corehost/cli/fxr/fx_muxer.cpp index 1ddb5ef13..2ab9bc800 100644 --- a/src/corehost/cli/fxr/fx_muxer.cpp +++ b/src/corehost/cli/fxr/fx_muxer.cpp @@ -248,6 +248,7 @@ int fx_muxer_t::parse_args_and_execute(const pal::string_t& own_dir, int argoff, if (exec_mode) { known_opts.push_back(_X("--depsfile")); + known_opts.push_back(_X("--runtimeconfig")); } // Parse the known muxer arguments if any. From e2e535d51009ff4fd9d5f279cec574a5565cf3a9 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 18:22:53 -0500 Subject: [PATCH 06/13] Fix x86 nuget package building. The non-runtime packages weren't being built on x86. The check looks for arch;. The semi-colon always needs to be after each architecture. --- .../Microsoft.NETCore.DotNetHost.pkgproj | 2 +- .../Microsoft.NETCore.DotNetHostPolicy.pkgproj | 2 +- .../Microsoft.NETCore.DotNetHostResolver.pkgproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj index cadcac320..b91148bc4 100644 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj +++ b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj @@ -6,7 +6,7 @@ $(HostVersion) true true - x64;x86 + x64;x86; $(PackagesOutputPath) true diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj index a582aaddb..99987033e 100644 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj @@ -6,7 +6,7 @@ $(HostPolicyVersion) true true - x64;x86 + x64;x86; $(PackagesOutputPath) true diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj index b6437bfbc..e7ca2451e 100644 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj @@ -6,7 +6,7 @@ $(HostResolverVersion) true true - x64;x86 + x64;x86; $(PackagesOutputPath) true From 0eb527a7c15c905e41a81aeb8c8afa931fad43fb Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Thu, 7 Apr 2016 18:07:51 -0700 Subject: [PATCH 07/13] change ordering of the args when invoking dotnet exec for xunit. Fix a bug in the host logic --- .../PackagedCommandSpecFactory.cs | 51 ++++++++++++------- src/corehost/cli/fxr/fx_muxer.cpp | 13 +++-- src/corehost/cli/hostpolicy.cpp | 2 +- src/corehost/cli/libhost.cpp | 25 +++++++-- src/corehost/cli/libhost.h | 4 +- 5 files changed, 70 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs index ae10b4812..db399bd3e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs @@ -107,29 +107,46 @@ namespace Microsoft.DotNet.Cli.Utils } arguments.Add("exec"); + + if (runtimeConfigPath != null) + { + arguments.Add("--runtimeconfig"); + arguments.Add(runtimeConfigPath); + } + + if (depsFilePath != null) + { + arguments.Add("--depsfile"); + arguments.Add(depsFilePath); + } + + arguments.Add("--additionalprobingpath"); + arguments.Add(nugetPackagesRoot); + + arguments.Add(commandPath); } else { host = CoreHost.HostExePath; + + arguments.Add(commandPath); + + if (runtimeConfigPath != null) + { + arguments.Add("--runtimeconfig"); + arguments.Add(runtimeConfigPath); + } + + if (depsFilePath != null) + { + arguments.Add("--depsfile"); + arguments.Add(depsFilePath); + } + + arguments.Add("--additionalprobingpath"); + arguments.Add(nugetPackagesRoot); } - arguments.Add(commandPath); - - if (runtimeConfigPath != null) - { - arguments.Add("--runtimeconfig"); - arguments.Add(runtimeConfigPath); - } - - if (depsFilePath != null) - { - arguments.Add("--depsfile"); - arguments.Add(depsFilePath); - } - - arguments.Add("--additionalprobingpath"); - arguments.Add(nugetPackagesRoot); - arguments.AddRange(commandArguments); return CreateCommandSpec(host, arguments, commandResolutionStrategy); diff --git a/src/corehost/cli/fxr/fx_muxer.cpp b/src/corehost/cli/fxr/fx_muxer.cpp index 2ab9bc800..e1767fb7a 100644 --- a/src/corehost/cli/fxr/fx_muxer.cpp +++ b/src/corehost/cli/fxr/fx_muxer.cpp @@ -314,11 +314,18 @@ int fx_muxer_t::parse_args_and_execute(const pal::string_t& own_dir, int argoff, trace::verbose(_X("Current argv is %s"), app_candidate.c_str()); pal::string_t app_or_deps = deps_file.empty() ? app_candidate : deps_file; - pal::string_t app_or_runtime_config = runtime_config.empty() ? app_candidate : runtime_config; pal::string_t config_file, dev_config_file; - trace::error(_X("Finding runtimeconfig.json from [%s]"), app_or_runtime_config.c_str()); - get_runtime_config_paths_from_file(app_or_runtime_config, &config_file, &dev_config_file); + if(runtime_config.empty()) + { + trace::verbose(_X("Finding runtimeconfig.json from [%s]"), app_candidate.c_str()); + get_runtime_config_paths_from_app(app_candidate, &config_file, &dev_config_file); + } + else + { + trace::verbose(_X("Finding runtimeconfig.json from [%s]"), runtime_config.c_str()); + get_runtime_config_paths_from_arg(runtime_config, &config_file, &dev_config_file); + } runtime_config_t config(config_file, dev_config_file); for (const auto& path : config.get_probe_paths()) diff --git a/src/corehost/cli/hostpolicy.cpp b/src/corehost/cli/hostpolicy.cpp index 6349e7ce3..8c00e493d 100644 --- a/src/corehost/cli/hostpolicy.cpp +++ b/src/corehost/cli/hostpolicy.cpp @@ -248,7 +248,7 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[]) { pal::string_t config_file, dev_config_file; - get_runtime_config_paths_from_file(args.managed_application, &config_file, &dev_config_file); + get_runtime_config_paths_from_app(args.managed_application, &config_file, &dev_config_file); runtime_config_t config(config_file, dev_config_file); if (!config.is_valid()) diff --git a/src/corehost/cli/libhost.cpp b/src/corehost/cli/libhost.cpp index a97c8ff19..63984952f 100644 --- a/src/corehost/cli/libhost.cpp +++ b/src/corehost/cli/libhost.cpp @@ -6,14 +6,33 @@ #include "trace.h" #include "libhost.h" -void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* cfg, pal::string_t* dev_cfg) +void get_runtime_config_paths_from_app(const pal::string_t& app, pal::string_t* cfg, pal::string_t* dev_cfg) { - auto name = get_filename_without_ext(file); + auto name = get_filename_without_ext(app); auto json_name = name + _X(".runtimeconfig.json"); auto dev_json_name = name + _X(".runtimeconfig.dev.json"); - auto json_path = get_directory(file); + auto json_path = get_directory(app); + auto dev_json_path = json_path; + + append_path(&json_path, json_name.c_str()); + append_path(&dev_json_path, dev_json_name.c_str()); + + trace::verbose(_X("Runtime config is cfg=%s dev=%s"), json_path.c_str(), dev_json_path.c_str()); + + dev_cfg->assign(dev_json_path); + cfg -> assign(json_path); +} + +void get_runtime_config_paths_from_arg(const pal::string_t& arg, pal::string_t* cfg, pal::string_t* dev_cfg) +{ + auto name = get_filename_without_ext(arg); + + auto json_name = name + _X(".json"); + auto dev_json_name = name + _X(".dev.json"); + + auto json_path = get_directory(arg); auto dev_json_path = json_path; append_path(&json_path, json_name.c_str()); diff --git a/src/corehost/cli/libhost.h b/src/corehost/cli/libhost.h index 27b29acf7..389e21d57 100644 --- a/src/corehost/cli/libhost.h +++ b/src/corehost/cli/libhost.h @@ -80,7 +80,9 @@ public: } }; -void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); +void get_runtime_config_paths_from_app(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); +void get_runtime_config_paths_from_arg(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); + host_mode_t detect_operating_mode(const int argc, const pal::char_t* argv[], pal::string_t* own_dir = nullptr); void try_patch_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str); From 4c704997c9a942d2a741654901d1cbfa214c953f Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 20:06:09 -0500 Subject: [PATCH 08/13] Remove infer-runtimes from EndToEnd tests. --- .../Commands/RestoreCommand.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs index 2e2985a4d..a533c1a91 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs @@ -15,7 +15,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities public override CommandResult Execute(string args="") { - args = $"restore {args} --infer-runtimes"; + args = $"restore {args}"; + return base.Execute(args); } } From 8a9068efbff66f85997c88a239c091779d61cea1 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 21:54:59 -0500 Subject: [PATCH 09/13] Fixing tests now they are portable. 2 tests needed to lift System.Diagnostics.TraceSource since it isn't in the shared framework. The ArgumentReflector is now a portable app, so it needs to be invoked with "dotnet". --- .../ArgumentForwardingTests.cs | 11 ++++++----- test/Microsoft.DotNet.Cli.Utils.Tests/project.json | 1 + .../project.json | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/ArgumentForwardingTests/ArgumentForwardingTests.cs b/test/ArgumentForwardingTests/ArgumentForwardingTests.cs index 8834625af..95be0edaa 100644 --- a/test/ArgumentForwardingTests/ArgumentForwardingTests.cs +++ b/test/ArgumentForwardingTests/ArgumentForwardingTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Text; using Xunit; @@ -18,7 +19,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding { public class ArgumentForwardingTests : TestBase { - private static readonly string s_reflectorExeName = "ArgumentsReflector" + Constants.ExeSuffix; + private static readonly string s_reflectorDllName = "ArgumentsReflector.dll"; private static readonly string s_reflectorCmdName = "reflector_cmd"; private string ReflectorPath { get; set; } @@ -38,7 +39,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding private void FindAndEnsureReflectorPresent() { - ReflectorPath = Path.Combine(AppContext.BaseDirectory, s_reflectorExeName); + ReflectorPath = Path.Combine(AppContext.BaseDirectory, s_reflectorDllName); ReflectorCmdPath = Path.Combine(AppContext.BaseDirectory, s_reflectorCmdName); File.Exists(ReflectorPath).Should().BeTrue(); } @@ -182,7 +183,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding /// private string[] EscapeAndEvaluateArgumentString(string[] rawEvaluatedArgument) { - var commandResult = Command.Create(ReflectorPath, rawEvaluatedArgument) + var commandResult = Command.Create("dotnet", new[] { ReflectorPath }.Concat(rawEvaluatedArgument)) .CaptureStdErr() .CaptureStdOut() .Execute(); @@ -262,8 +263,8 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding { StartInfo = new ProcessStartInfo { - FileName = ReflectorPath, - Arguments = testUserArgument, + FileName = Env.GetCommandPath("dotnet", ".exe", ""), + Arguments = $"{ReflectorPath} {testUserArgument}", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 6eacbd4e1..2f693bd56 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -8,6 +8,7 @@ "type": "platform", "version": "1.0.0-rc2-*" }, + "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1130", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index 1ead922b7..f936e4f0f 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -9,6 +9,7 @@ "type": "platform", "version": "1.0.0-rc2-*" }, + "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, From 7d6d74bba25270843fdea1811afae2f05b79414c Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 22:08:17 -0500 Subject: [PATCH 10/13] Fixing dotnet-test.Tests to use a portable test app - ProjectWithTests. The ProjectWithTests needed to be moved outside of TestAssets\TestProjects because it can't be restored --infer-runtimes and it has to be built with netcoreapp1.0. --- .../GivenThatIWantSomeFakeTests.cs | 0 .../ProjectWithTests/project.json | 10 +++++++--- scripts/dotnet-cli-build/TestTargets.cs | 20 ++++++++++++++++++- .../GivenThatWeWantToRunTestsInTheConsole.cs | 9 +++++---- ...hatWeWantToUseDotnetTestE2EInDesignTime.cs | 8 +++++--- 5 files changed, 36 insertions(+), 11 deletions(-) rename TestAssets/{TestProjects => }/ProjectWithTests/GivenThatIWantSomeFakeTests.cs (100%) rename TestAssets/{TestProjects => }/ProjectWithTests/project.json (62%) diff --git a/TestAssets/TestProjects/ProjectWithTests/GivenThatIWantSomeFakeTests.cs b/TestAssets/ProjectWithTests/GivenThatIWantSomeFakeTests.cs similarity index 100% rename from TestAssets/TestProjects/ProjectWithTests/GivenThatIWantSomeFakeTests.cs rename to TestAssets/ProjectWithTests/GivenThatIWantSomeFakeTests.cs diff --git a/TestAssets/TestProjects/ProjectWithTests/project.json b/TestAssets/ProjectWithTests/project.json similarity index 62% rename from TestAssets/TestProjects/ProjectWithTests/project.json rename to TestAssets/ProjectWithTests/project.json index eba1ae115..ffe054cb0 100644 --- a/TestAssets/TestProjects/ProjectWithTests/project.json +++ b/TestAssets/ProjectWithTests/project.json @@ -1,15 +1,19 @@ { "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Linq.Expressions": "4.0.11-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index 5e394ba1d..9df8b95a0 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -93,7 +93,17 @@ namespace Microsoft.DotNet.Cli.Build "--fallbacksource", Dirs.TestPackages, "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) - .Execute().EnsureSuccessful(); + .Execute() + .EnsureSuccessful(); + + // The 'ProjectWithTests' is a portable test app. Cannot call --infer-runtimes on it, since on win x64 machines, + // the x86 runtime is being inferred, and there are no x86 DotNetHost packages + dotnet.Restore( + "--verbosity", "verbose", + "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectWithTests")) + .Execute() + .EnsureSuccessful(); // The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output dotnet.Restore( @@ -248,6 +258,14 @@ namespace Microsoft.DotNet.Cli.Build .EnsureSuccessful(); } + // build ProjectWithTests, which is outside of TestProjects and targets netcoreapp + string projectWithTests = Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectWithTests"); + c.Info($"Building: {projectWithTests}"); + dotnet.Build("--framework", "netcoreapp1.0") + .WorkingDirectory(projectWithTests) + .Execute() + .EnsureSuccessful(); + return c.Success(); } diff --git a/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs b/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs index c196e8b45..e431ca7ee 100644 --- a/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs +++ b/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs @@ -4,6 +4,7 @@ using System; using System.IO; using Microsoft.DotNet.ProjectModel; +using Microsoft.DotNet.TestFramework; using Microsoft.Extensions.PlatformAbstractions; using Xunit; using Microsoft.DotNet.Tools.Test.Utilities; @@ -18,8 +19,9 @@ namespace Microsoft.Dotnet.Tools.Test.Tests public GivenThatWeWantToRunTestsInTheConsole() { + var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); var testInstance = - TestAssetsManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles(); + testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles(); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); var contexts = ProjectContext.CreateContextForEachFramework( @@ -27,8 +29,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests null, PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); - var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier; - _defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, runtime); + _defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); } //ISSUE https://github.com/dotnet/cli/issues/1935 @@ -55,7 +56,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests { var testCommand = new DotnetTestCommand(); var result = testCommand.Execute( - $"{_projectFilePath} -o {Path.Combine(AppContext.BaseDirectory, "output")} -f netstandardapp1.5"); + $"{_projectFilePath} -o {Path.Combine(AppContext.BaseDirectory, "output")} -f netcoreapp1.0"); result.Should().Pass(); } diff --git a/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs b/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs index 570e9d316..a3e4fd1af 100644 --- a/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs +++ b/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.DotNet.ProjectModel; +using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using System.IO; using FluentAssertions; @@ -18,15 +19,16 @@ namespace Microsoft.Dotnet.Tools.Test.Tests public GivenThatWeWantToUseDotnetTestE2EInDesignTime() { - var testInstance = TestAssetsManager.CreateTestInstance("ProjectWithTests").WithLockFiles(); + var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); + var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests").WithLockFiles(); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); var contexts = ProjectContext.CreateContextForEachFramework( _projectFilePath, null, PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); - var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier; - _outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, runtime); + + _outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); var buildCommand = new BuildCommand(_projectFilePath); var result = buildCommand.Execute(); From e5e7ab1e4773d1018b52cc827572ffb229cc6e45 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Fri, 8 Apr 2016 10:30:26 -0500 Subject: [PATCH 11/13] Fixing dotnet.Tests to pass the correct TFM into the dependency-tool-invoker. --- test/dotnet.Tests/PackagedCommandTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index b53f44eae..3202b75e4 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -79,7 +79,7 @@ namespace Microsoft.DotNet.Tests var projectOutputPath = $"AppWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe"; return new[] { - new object[] { ".NETStandardApp,Version=v1.5", "CoreFX", "lib\\netstandard1.5\\dotnet-desktop-and-portable.dll" }, + new object[] { ".NETStandard,Version=v1.5", "CoreFX", "lib\\netstandard1.5\\dotnet-desktop-and-portable.dll" }, new object[] { ".NETFramework,Version=v4.5.1", "NetFX", projectOutputPath } }; } From 5684f9933df0164368e1a52dba2a83976799997b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Fri, 8 Apr 2016 11:35:13 -0500 Subject: [PATCH 12/13] Fix dotnet-test.UnitTests now that ProjectWithTests has moved outside of TestAssets/TestProjects. --- test/dotnet-test.UnitTests/GivenATestCommand.cs | 1 - test/dotnet-test.UnitTests/project.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/dotnet-test.UnitTests/GivenATestCommand.cs b/test/dotnet-test.UnitTests/GivenATestCommand.cs index 2d0e5c405..86555da1f 100644 --- a/test/dotnet-test.UnitTests/GivenATestCommand.cs +++ b/test/dotnet-test.UnitTests/GivenATestCommand.cs @@ -16,7 +16,6 @@ namespace Microsoft.Dotnet.Tools.Test.Tests private static readonly string ProjectJsonPath = Path.Combine( AppContext.BaseDirectory, "TestAssets", - "TestProjects", "ProjectWithTests", "project.json"); diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index bcc16494a..d45a2e5aa 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -28,7 +28,7 @@ } }, "content": [ - "../../TestAssets/TestProjects/ProjectWithTests/project.json" + "../../TestAssets/ProjectWithTests/project.json" ], "testRunner": "xunit" } From 9f61ad51aa833046b1c9fd795010ec6d8945e1af Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Fri, 8 Apr 2016 12:52:57 -0500 Subject: [PATCH 13/13] Check if runtimeConfigPath exists before reading the file in IsPortableApp. If it doesn't exist, then it isn't a portable app. --- .../CommandResolution/PackagedCommandSpecFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs index db399bd3e..0fd1eb90e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs @@ -170,7 +170,7 @@ namespace Microsoft.DotNet.Cli.Utils ? Directory.EnumerateFiles(commandDir).FirstOrDefault(x => x.EndsWith("runtimeconfig.json")) : runtimeConfigPath; - if (runtimeConfigPath == null) + if (runtimeConfigPath == null || !File.Exists(runtimeConfigPath)) { return false; }