From f4c4db4d3a733fbbd653a8f9050140772a73d771 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 25 Apr 2017 14:26:21 -0500 Subject: [PATCH 01/68] update-dependencies hard-coded values Read MSBuild property values to get GITHUB_UPSTREAM_BRANCH and CORESETUP_VERSION_FRAGMENT instead of hard-coding them in update-dependencies. --- build_projects/update-dependencies/Config.cs | 42 +++++++++++++++++-- build_projects/update-dependencies/Program.cs | 1 - 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/build_projects/update-dependencies/Config.cs b/build_projects/update-dependencies/Config.cs index e9c08ac10..9938cce68 100644 --- a/build_projects/update-dependencies/Config.cs +++ b/build_projects/update-dependencies/Config.cs @@ -2,6 +2,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.IO; +using System.Linq; +using System.Xml.Linq; namespace Microsoft.DotNet.Scripts { @@ -35,11 +38,10 @@ namespace Microsoft.DotNet.Scripts private Lazy _password = new Lazy(() => GetEnvironmentVariable("GITHUB_PASSWORD")); private Lazy _dotNetVersionUrl = new Lazy(() => GetEnvironmentVariable("DOTNET_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info")); - private Lazy _roslynVersionFragment = new Lazy(() => GetEnvironmentVariable("ROSLYN_VERSION_FRAGMENT", "dotnet/roslyn/netcore1.0")); - private Lazy _coreSetupVersionFragment = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_FRAGMENT", "dotnet/core-setup/master")); + private Lazy _coreSetupVersionFragment = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_FRAGMENT", GetDefaultCoreSetupVersionFragment())); private Lazy _gitHubUpstreamOwner = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_OWNER", "dotnet")); private Lazy _gitHubProject = new Lazy(() => GetEnvironmentVariable("GITHUB_PROJECT", "cli")); - private Lazy _gitHubUpstreamBranch = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", "master")); + private Lazy _gitHubUpstreamBranch = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", GetDefaultUpstreamBranch())); private Lazy _gitHubPullRequestNotifications = new Lazy(() => GetEnvironmentVariable("GITHUB_PULL_REQUEST_NOTIFICATIONS", "") .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); @@ -51,7 +53,6 @@ namespace Microsoft.DotNet.Scripts public string Email => _email.Value; public string Password => _password.Value; public string DotNetVersionUrl => _dotNetVersionUrl.Value; - public string RoslynVersionFragment => _roslynVersionFragment.Value; public string CoreSetupVersionFragment => _coreSetupVersionFragment.Value; public string GitHubUpstreamOwner => _gitHubUpstreamOwner.Value; public string GitHubProject => _gitHubProject.Value; @@ -73,5 +74,38 @@ namespace Microsoft.DotNet.Scripts return value; } + + private static string GetDefaultUpstreamBranch() + { + return GetRepoMSBuildPropValue("BranchInfo.props", "BranchName") ?? "master"; + } + + private static string GetDefaultCoreSetupVersionFragment() + { + string coreSetupChannel = GetRepoMSBuildPropValue("BundledRuntimes.props", "CoreSetupChannel") ?? "master"; + + return $"dotnet/core-setup/{coreSetupChannel}"; + } + + private static string GetRepoMSBuildPropValue(string propsFileName, string propertyName) + { + var propsFilePath = Path.Combine(Dirs.RepoRoot, "build", propsFileName); + var root = XDocument.Load(propsFilePath).Root; + var ns = root.Name.Namespace; + + var value = root + .Elements(ns + "PropertyGroup") + .Elements(ns + propertyName) + .FirstOrDefault() + ?.Value; + + if (string.IsNullOrEmpty(value)) + { + Console.WriteLine($"Could not find a property named '{propertyName}' in {propsFilePath}"); + return null; + } + + return value; + } } } diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index 6da45dc9a..296ad2d0a 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -25,7 +25,6 @@ namespace Microsoft.DotNet.Scripts List buildInfos = new List(); - buildInfos.Add(GetBuildInfo("Roslyn", s_config.RoslynVersionFragment, fetchLatestReleaseFile: false)); buildInfos.Add(GetBuildInfo("CoreSetup", s_config.CoreSetupVersionFragment, fetchLatestReleaseFile: false)); IEnumerable updaters = GetUpdaters(); From c8a6b7b97a7487d7d942e251ca43ad068ae9ec58 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 18 Apr 2017 18:39:15 -0700 Subject: [PATCH 02/68] Add .binlog (MSBuild binary log format) extension to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3fc22dc00..7bed92752 100644 --- a/.gitignore +++ b/.gitignore @@ -115,6 +115,7 @@ artifacts/ *.tmp *.tmp_proj *.log +*.binlog *.vspscc *.vssscc .builds From fa51bb43fc861f9d4ba7b8fca199dc96edcfd299 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 18 Apr 2017 18:48:53 -0700 Subject: [PATCH 03/68] Call into project in .NET SDK to create deps.json files for tools instead of doing so directly --- .../IPackagedCommandSpecFactory.cs | 12 +- .../CommandResolution/IProject.cs | 2 + .../CommandResolution/MSBuildProject.cs | 13 +++ .../PackagedCommandSpecFactory.cs | 36 +----- .../ProjectDependenciesCommandResolver.cs | 4 +- .../ProjectToolsCommandResolver.cs | 70 +++++++++--- .../Extensions/LockFileExtensions.cs | 33 ++++++ .../ForwardingAppImplementation.cs | 108 ++++++++++++++++++ .../MSBuildForwardingAppWithoutLogging.cs | 84 ++++++++++++++ .../ProcessStartInfoExtensions.cs | 2 +- src/dotnet/ForwardingApp.cs | 92 +++------------ src/dotnet/NuGetForwardingApp.cs | 1 + .../dotnet-msbuild/MSBuildForwardingApp.cs | 75 +++--------- 13 files changed, 337 insertions(+), 195 deletions(-) create mode 100644 src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs create mode 100644 src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs create mode 100644 src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs rename src/{dotnet => Microsoft.DotNet.Cli.Utils}/ProcessStartInfoExtensions.cs (95%) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs index 20f8a3302..15ed9fde5 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs @@ -8,22 +8,14 @@ namespace Microsoft.DotNet.Cli.Utils { public interface IPackagedCommandSpecFactory { - CommandSpec CreateCommandSpecFromLibrary( - LockFileTargetLibrary toolLibrary, - string commandName, - IEnumerable commandArguments, - IEnumerable allowedExtensions, - string nugetPackagesRoot, - CommandResolutionStrategy commandResolutionStrategy, - string depsFilePath, - string runtimeConfigPath); + // Code review TODO: Is it OK to make breaking changes to the CLI Utils API surface? CommandSpec CreateCommandSpecFromLibrary( LockFileTargetLibrary toolLibrary, string commandName, IEnumerable commandArguments, IEnumerable allowedExtensions, - IEnumerable packageFolders, + LockFile lockFile, CommandResolutionStrategy commandResolutionStrategy, string depsFilePath, string runtimeConfigPath); diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs index 9a97bb1e5..534d77ebe 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs @@ -26,5 +26,7 @@ namespace Microsoft.DotNet.Cli.Utils NuGetFramework DotnetCliToolTargetFramework { get; } Dictionary EnvironmentVariables { get; } + + string ToolDepsJsonGeneratorProject { get; } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs index cb006e4a5..f5473c278 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs @@ -92,6 +92,19 @@ namespace Microsoft.DotNet.Cli.Utils } } + public string ToolDepsJsonGeneratorProject + { + get + { + var generatorProject = _project + .AllEvaluatedProperties + .FirstOrDefault(p => p.Name.Equals("ToolDepsJsonGeneratorProject")) + ?.EvaluatedValue; + + return generatorProject; + } + } + public MSBuildProject( string msBuildProjectPath, NuGetFramework framework, diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs index e7bd1b33c..2ee8bcb6a 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactory.cs @@ -27,28 +27,7 @@ namespace Microsoft.DotNet.Cli.Utils string commandName, IEnumerable commandArguments, IEnumerable allowedExtensions, - string nugetPackagesRoot, - CommandResolutionStrategy commandResolutionStrategy, - string depsFilePath, - string runtimeConfigPath) - { - return CreateCommandSpecFromLibrary( - toolLibrary, - commandName, - commandArguments, - allowedExtensions, - new List { nugetPackagesRoot }, - commandResolutionStrategy, - depsFilePath, - runtimeConfigPath); - } - - public CommandSpec CreateCommandSpecFromLibrary( - LockFileTargetLibrary toolLibrary, - string commandName, - IEnumerable commandArguments, - IEnumerable allowedExtensions, - IEnumerable packageFolders, + LockFile lockFile, CommandResolutionStrategy commandResolutionStrategy, string depsFilePath, string runtimeConfigPath) @@ -72,7 +51,7 @@ namespace Microsoft.DotNet.Cli.Utils return null; } - var commandPath = GetCommandFilePath(packageFolders, toolLibrary, toolAssembly); + var commandPath = GetCommandFilePath(lockFile, toolLibrary, toolAssembly); if (!File.Exists(commandPath)) { @@ -89,21 +68,16 @@ namespace Microsoft.DotNet.Cli.Utils commandArguments, depsFilePath, commandResolutionStrategy, - packageFolders, + lockFile.GetNormalizedPackageFolders(), runtimeConfigPath); } private string GetCommandFilePath( - IEnumerable packageFolders, + LockFile lockFile, LockFileTargetLibrary toolLibrary, LockFileItem runtimeAssembly) { - var packageFoldersCount = packageFolders.Count(); - var userPackageFolder = packageFoldersCount == 1 ? string.Empty : packageFolders.First(); - var fallbackPackageFolders = packageFoldersCount > 1 ? packageFolders.Skip(1) : packageFolders; - - var packageDirectory = new FallbackPackagePathResolver(userPackageFolder, fallbackPackageFolders) - .GetPackageDirectory(toolLibrary.Name, toolLibrary.Version); + var packageDirectory = lockFile.GetPackageDirectory(toolLibrary); if (packageDirectory == null) { diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs index 9c1e97e5b..557ca3b25 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectDependenciesCommandResolver.cs @@ -120,15 +120,13 @@ namespace Microsoft.DotNet.Cli.Utils var lockFile = project.GetLockFile(); var toolLibrary = GetToolLibraryForContext(lockFile, commandName, framework); - var normalizedNugetPackagesRoot = - PathUtility.EnsureNoTrailingDirectorySeparator(lockFile.PackageFolders.First().Path); var commandSpec = _packagedCommandSpecFactory.CreateCommandSpecFromLibrary( toolLibrary, commandName, commandArguments, allowedExtensions, - normalizedNugetPackagesRoot, + lockFile, s_commandResolutionStrategy, depsFilePath, runtimeConfigPath); diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index 85f82bcd2..d95cfead2 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -170,10 +170,8 @@ namespace Microsoft.DotNet.Cli.Utils toolLibraryRange, toolPackageFramework, toolLockFile, - depsFileRoot); - - var packageFolders = toolLockFile.PackageFolders.Select(p => - PathUtility.EnsureNoTrailingDirectorySeparator(p.Path)); + depsFileRoot, + project.ToolDepsJsonGeneratorProject); Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.AttemptingToCreateCommandSpec, @@ -184,7 +182,7 @@ namespace Microsoft.DotNet.Cli.Utils commandName, args, _allowedCommandExtensions, - packageFolders, + toolLockFile, s_commandResolutionStrategy, depsFilePath, null); @@ -281,7 +279,8 @@ namespace Microsoft.DotNet.Cli.Utils SingleProjectInfo toolLibrary, NuGetFramework framework, LockFile toolLockFile, - string depsPathRoot) + string depsPathRoot, + string toolDepsJsonGeneratorProject) { var depsJsonPath = Path.Combine( depsPathRoot, @@ -292,7 +291,7 @@ namespace Microsoft.DotNet.Cli.Utils ProjectToolsCommandResolverName, depsJsonPath)); - EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary); + EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary, toolDepsJsonGeneratorProject); return depsJsonPath; } @@ -301,11 +300,12 @@ namespace Microsoft.DotNet.Cli.Utils LockFile toolLockFile, NuGetFramework framework, string depsPath, - SingleProjectInfo toolLibrary) + SingleProjectInfo toolLibrary, + string toolDepsJsonGeneratorProject) { if (!File.Exists(depsPath)) { - GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary); + GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary, toolDepsJsonGeneratorProject); } } @@ -313,7 +313,8 @@ namespace Microsoft.DotNet.Cli.Utils LockFile toolLockFile, NuGetFramework framework, string depsPath, - SingleProjectInfo toolLibrary) + SingleProjectInfo toolLibrary, + string toolDepsJsonGeneratorProject) { Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.GeneratingDepsJson, @@ -323,11 +324,52 @@ namespace Microsoft.DotNet.Cli.Utils .Build(toolLibrary, null, toolLockFile, framework, null); var tempDepsFile = Path.GetTempFileName(); - using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write)) - { - var dependencyContextWriter = new DependencyContextWriter(); - dependencyContextWriter.Write(dependencyContext, fileStream); + var args = new List(); + + args.Add(toolDepsJsonGeneratorProject); + args.Add($"/p:ProjectAssetsFile=\"{toolLockFile.Path}\""); + args.Add($"/p:ToolName={toolLibrary.Name}"); + args.Add($"/p:ProjectDepsFilePath={tempDepsFile}"); + + + // Look for the .props file in the Microsoft.NETCore.App package, until NuGet + // generates .props and .targets files for tool restores (https://github.com/NuGet/Home/issues/5037) + var platformLibrary = toolLockFile.Targets + .FirstOrDefault(t => framework == t.TargetFramework) + ?.GetPlatformLibrary(); + + if (platformLibrary != null) + { + string buildRelativePath = platformLibrary.Build.FirstOrDefault()?.Path; + + var platformLibraryPath = toolLockFile.GetPackageDirectory(platformLibrary); + + if (platformLibraryPath != null && buildRelativePath != null) + { + // Get rid of "_._" filename + buildRelativePath = Path.GetDirectoryName(buildRelativePath); + + string platformLibraryBuildFolderPath = Path.Combine(platformLibraryPath, buildRelativePath); + var platformLibraryPropsFile = Directory.GetFiles(platformLibraryBuildFolderPath, "*.props").FirstOrDefault(); + + if (platformLibraryPropsFile != null) + { + args.Add($"/p:AdditionalImport={platformLibraryPropsFile}"); + } + } + } + + // Delete temporary file created by Path.GetTempFileName(), otherwise the GenerateBuildDependencyFile target + // will think the deps file is up-to-date and skip executing + File.Delete(tempDepsFile); + + var result = new MSBuildForwardingAppWithoutLogging(args).Execute(); + + if (result != 0) + { + // TODO: Can / should we show the MSBuild output if there is a failure? + throw new GracefulException(string.Format(LocalizableStrings.UnableToGenerateDepsJson, toolDepsJsonGeneratorProject)); } try diff --git a/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs new file mode 100644 index 000000000..5b504badf --- /dev/null +++ b/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs @@ -0,0 +1,33 @@ +using Microsoft.DotNet.Tools.Common; +using NuGet.Packaging; +using NuGet.ProjectModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.DotNet.Cli.Utils +{ + static class LockFileExtensions + { + public static string GetPackageDirectory(this LockFile lockFile, LockFileTargetLibrary library) + { + var packageFolders = lockFile.GetNormalizedPackageFolders(); + + var packageFoldersCount = packageFolders.Count(); + var userPackageFolder = packageFoldersCount == 1 ? string.Empty : packageFolders.First(); + var fallbackPackageFolders = packageFoldersCount > 1 ? packageFolders.Skip(1) : packageFolders; + + var packageDirectory = new FallbackPackagePathResolver(userPackageFolder, fallbackPackageFolders) + .GetPackageDirectory(library.Name, library.Version); + + return packageDirectory; + } + + public static IEnumerable GetNormalizedPackageFolders(this LockFile lockFile) + { + return lockFile.PackageFolders.Select(p => + PathUtility.EnsureNoTrailingDirectorySeparator(p.Path)); + } + } +} diff --git a/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs b/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs new file mode 100644 index 000000000..cb5098bc0 --- /dev/null +++ b/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs @@ -0,0 +1,108 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.DotNet.Cli.Utils; + +namespace Microsoft.DotNet.Cli.Utils +{ + /// + /// A class which encapsulates logic needed to forward arguments from the current process to another process + /// invoked with the dotnet.exe host. + /// + internal class ForwardingAppImplementation + { + private const string s_hostExe = "dotnet"; + + private readonly string _forwardApplicationPath; + private readonly IEnumerable _argsToForward; + private readonly string _depsFile; + private readonly string _runtimeConfig; + private readonly string _additionalProbingPath; + private Dictionary _environmentVariables; + + private readonly string[] _allArgs; + + public ForwardingAppImplementation( + string forwardApplicationPath, + IEnumerable argsToForward, + string depsFile = null, + string runtimeConfig = null, + string additionalProbingPath = null, + Dictionary environmentVariables = null) + { + _forwardApplicationPath = forwardApplicationPath; + _argsToForward = argsToForward; + _depsFile = depsFile; + _runtimeConfig = runtimeConfig; + _additionalProbingPath = additionalProbingPath; + _environmentVariables = environmentVariables; + + var allArgs = new List(); + allArgs.Add("exec"); + + if (_depsFile != null) + { + allArgs.Add("--depsfile"); + allArgs.Add(_depsFile); + } + + if (_runtimeConfig != null) + { + allArgs.Add("--runtimeconfig"); + allArgs.Add(_runtimeConfig); + } + + if (_additionalProbingPath != null) + { + allArgs.Add("--additionalprobingpath"); + allArgs.Add(_additionalProbingPath); + } + + allArgs.Add(_forwardApplicationPath); + allArgs.AddRange(_argsToForward); + + _allArgs = allArgs.ToArray(); + } + + public int Execute() + { + return GetProcessStartInfo().Execute(); + } + + public ProcessStartInfo GetProcessStartInfo() + { + var processInfo = new ProcessStartInfo + { + FileName = GetHostExeName(), + Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(_allArgs), + UseShellExecute = false + }; + + if (_environmentVariables != null) + { + foreach (var entry in _environmentVariables) + { + processInfo.Environment[entry.Key] = entry.Value; + } + } + + return processInfo; + } + + public ForwardingAppImplementation WithEnvironmentVariable(string name, string value) + { + _environmentVariables = _environmentVariables ?? new Dictionary(); + + _environmentVariables.Add(name, value); + + return this; + } + + private string GetHostExeName() + { + return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}"; + } + } +} diff --git a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs new file mode 100644 index 000000000..552befdab --- /dev/null +++ b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.DotNet.Cli.Utils +{ + internal class MSBuildForwardingAppWithoutLogging + { + private const string MSBuildExeName = "MSBuild.dll"; + + private const string SdksDirectoryName = "Sdks"; + + private readonly ForwardingAppImplementation _forwardingApp; + + private readonly Dictionary _msbuildRequiredEnvironmentVariables = + new Dictionary + { + { "MSBuildExtensionsPath", AppContext.BaseDirectory }, + { "CscToolExe", GetRunCscPath() }, + { "MSBuildSDKsPath", GetMSBuildSDKsPath() } + }; + + private readonly IEnumerable _msbuildRequiredParameters = + new List { "/m", "/v:m" }; + + public MSBuildForwardingAppWithoutLogging(IEnumerable argsToForward, string msbuildPath = null) + { + _forwardingApp = new ForwardingAppImplementation( + msbuildPath ?? GetMSBuildExePath(), + _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)), + environmentVariables: _msbuildRequiredEnvironmentVariables); + } + + public virtual ProcessStartInfo GetProcessStartInfo() + { + return _forwardingApp + .GetProcessStartInfo(); + } + + public int Execute() + { + return GetProcessStartInfo().Execute(); + } + + private static string Escape(string arg) => + // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 + (arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ? + arg.Replace(";", "%3B") + .Replace("://", ":%2F%2F") : + arg; + + private static string GetMSBuildExePath() + { + return Path.Combine( + AppContext.BaseDirectory, + MSBuildExeName); + } + + private static string GetMSBuildSDKsPath() + { + var envMSBuildSDKsPath = Environment.GetEnvironmentVariable("MSBuildSDKsPath"); + + if (envMSBuildSDKsPath != null) + { + return envMSBuildSDKsPath; + } + + return Path.Combine( + AppContext.BaseDirectory, + SdksDirectoryName); + } + + private static string GetRunCscPath() + { + var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh"; + return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunCsc{scriptExtension}"); + } + } +} + diff --git a/src/dotnet/ProcessStartInfoExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs similarity index 95% rename from src/dotnet/ProcessStartInfoExtensions.cs rename to src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs index cb8e0de83..0805a7b41 100644 --- a/src/dotnet/ProcessStartInfoExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; -namespace Microsoft.DotNet.Cli +namespace Microsoft.DotNet.Cli.Utils { internal static class ProcessStartInfoExtensions { diff --git a/src/dotnet/ForwardingApp.cs b/src/dotnet/ForwardingApp.cs index 2ae292b75..6b44c650e 100644 --- a/src/dotnet/ForwardingApp.cs +++ b/src/dotnet/ForwardingApp.cs @@ -1,28 +1,14 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - +using Microsoft.DotNet.Cli.Utils; +using System; using System.Collections.Generic; using System.Diagnostics; -using Microsoft.DotNet.Cli.Utils; +using System.Text; namespace Microsoft.DotNet.Cli { - /// - /// A class which encapsulates logic needed to forward arguments from the current process to another process - /// invoked with the dotnet.exe host. - /// public class ForwardingApp { - private const string s_hostExe = "dotnet"; - - private readonly string _forwardApplicationPath; - private readonly IEnumerable _argsToForward; - private readonly string _depsFile; - private readonly string _runtimeConfig; - private readonly string _additionalProbingPath; - private Dictionary _environmentVariables; - - private readonly string[] _allArgs; + ForwardingAppImplementation _implementation; public ForwardingApp( string forwardApplicationPath, @@ -32,77 +18,29 @@ namespace Microsoft.DotNet.Cli string additionalProbingPath = null, Dictionary environmentVariables = null) { - _forwardApplicationPath = forwardApplicationPath; - _argsToForward = argsToForward; - _depsFile = depsFile; - _runtimeConfig = runtimeConfig; - _additionalProbingPath = additionalProbingPath; - _environmentVariables = environmentVariables; - - var allArgs = new List(); - allArgs.Add("exec"); - - if (_depsFile != null) - { - allArgs.Add("--depsfile"); - allArgs.Add(_depsFile); - } - - if (_runtimeConfig != null) - { - allArgs.Add("--runtimeconfig"); - allArgs.Add(_runtimeConfig); - } - - if (_additionalProbingPath != null) - { - allArgs.Add("--additionalprobingpath"); - allArgs.Add(_additionalProbingPath); - } - - allArgs.Add(_forwardApplicationPath); - allArgs.AddRange(_argsToForward); - - _allArgs = allArgs.ToArray(); - } - - public int Execute() - { - return GetProcessStartInfo().Execute(); + _implementation = new ForwardingAppImplementation( + forwardApplicationPath, + argsToForward, + depsFile, + runtimeConfig, + additionalProbingPath, + environmentVariables); } public ProcessStartInfo GetProcessStartInfo() { - var processInfo = new ProcessStartInfo - { - FileName = GetHostExeName(), - Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(_allArgs), - UseShellExecute = false - }; - - if (_environmentVariables != null) - { - foreach (var entry in _environmentVariables) - { - processInfo.Environment[entry.Key] = entry.Value; - } - } - - return processInfo; + return _implementation.GetProcessStartInfo(); } public ForwardingApp WithEnvironmentVariable(string name, string value) { - _environmentVariables = _environmentVariables ?? new Dictionary(); - - _environmentVariables.Add(name, value); - + _implementation = _implementation.WithEnvironmentVariable(name, value); return this; } - private string GetHostExeName() + public int Execute() { - return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}"; + return _implementation.Execute(); } } } diff --git a/src/dotnet/NuGetForwardingApp.cs b/src/dotnet/NuGetForwardingApp.cs index 04e86623a..bf5852f75 100644 --- a/src/dotnet/NuGetForwardingApp.cs +++ b/src/dotnet/NuGetForwardingApp.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools { diff --git a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs index 78b2e5861..c4e42fe2d 100644 --- a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs +++ b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs @@ -10,6 +10,7 @@ using System.Runtime.InteropServices; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.CommandLine; using System.Diagnostics; +using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.MSBuild { @@ -17,24 +18,9 @@ namespace Microsoft.DotNet.Tools.MSBuild { internal const string TelemetrySessionIdEnvironmentVariableName = "DOTNET_CLI_TELEMETRY_SESSIONID"; - private const string MSBuildExeName = "MSBuild.dll"; + private MSBuildForwardingAppWithoutLogging _forwardingAppWithoutLogging; - private const string SdksDirectoryName = "Sdks"; - - private readonly ForwardingApp _forwardingApp; - - private readonly Dictionary _msbuildRequiredEnvironmentVariables = - new Dictionary - { - { "MSBuildExtensionsPath", AppContext.BaseDirectory }, - { "CscToolExe", GetRunCscPath() }, - { "MSBuildSDKsPath", GetMSBuildSDKsPath() } - }; - - private readonly IEnumerable _msbuildRequiredParameters = - new List { "/m", "/v:m" }; - - public MSBuildForwardingApp(IEnumerable argsToForward, string msbuildPath = null) + static IEnumerable ConcatTelemetryLogger(IEnumerable argsToForward) { if (Telemetry.CurrentSessionId != null) { @@ -42,7 +28,7 @@ namespace Microsoft.DotNet.Tools.MSBuild { Type loggerType = typeof(MSBuildLogger); - argsToForward = argsToForward + return argsToForward .Concat(new[] { $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" @@ -53,57 +39,28 @@ namespace Microsoft.DotNet.Tools.MSBuild // Exceptions during telemetry shouldn't cause anything else to fail } } + return argsToForward; + } - _forwardingApp = new ForwardingApp( - msbuildPath ?? GetMSBuildExePath(), - _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)), - environmentVariables: _msbuildRequiredEnvironmentVariables); + public MSBuildForwardingApp(IEnumerable argsToForward, string msbuildPath = null) + { + _forwardingAppWithoutLogging = new MSBuildForwardingAppWithoutLogging( + ConcatTelemetryLogger(argsToForward), + msbuildPath); } public ProcessStartInfo GetProcessStartInfo() { - return _forwardingApp - .WithEnvironmentVariable(TelemetrySessionIdEnvironmentVariableName, Telemetry.CurrentSessionId) - .GetProcessStartInfo(); + var ret = _forwardingAppWithoutLogging.GetProcessStartInfo(); + + ret.Environment[TelemetrySessionIdEnvironmentVariableName] = Telemetry.CurrentSessionId; + + return ret; } public int Execute() { return GetProcessStartInfo().Execute(); } - - private static string Escape(string arg) => - // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 - (arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ? - arg.Replace(";", "%3B") - .Replace("://", ":%2F%2F") : - arg; - - private static string GetMSBuildExePath() - { - return Path.Combine( - AppContext.BaseDirectory, - MSBuildExeName); - } - - private static string GetMSBuildSDKsPath() - { - var envMSBuildSDKsPath = Environment.GetEnvironmentVariable("MSBuildSDKsPath"); - - if (envMSBuildSDKsPath != null) - { - return envMSBuildSDKsPath; - } - - return Path.Combine( - AppContext.BaseDirectory, - SdksDirectoryName); - } - - private static string GetRunCscPath() - { - var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh"; - return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunCsc{scriptExtension}"); - } } } From 5c679cd32e2efa3fd8b8dcef5aef4b45f96757ed Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 21 Apr 2017 16:14:44 -0700 Subject: [PATCH 04/68] Test fixes for tools deps.json generation --- .../ProjectToolsCommandResolver.cs | 17 ++++++++++++++++- .../LocalizableStrings.cs | 2 ++ .../GivenAProjectToolsCommandResolver.cs | 10 +++++++++- .../GivenDotnetMSBuildBuildsProjects.cs | 11 +++++++++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index d95cfead2..41688de82 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -316,6 +316,12 @@ namespace Microsoft.DotNet.Cli.Utils SingleProjectInfo toolLibrary, string toolDepsJsonGeneratorProject) { + if (string.IsNullOrEmpty(toolDepsJsonGeneratorProject) || + !File.Exists(toolDepsJsonGeneratorProject)) + { + throw new GracefulException(LocalizableStrings.DepsJsonGeneratorProjectNotSet); + } + Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.GeneratingDepsJson, depsPath)); @@ -332,6 +338,9 @@ namespace Microsoft.DotNet.Cli.Utils args.Add($"/p:ToolName={toolLibrary.Name}"); args.Add($"/p:ProjectDepsFilePath={tempDepsFile}"); + var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName(); + args.Add($"/p:TargetFramework={toolTargetFramework}"); + // Look for the .props file in the Microsoft.NETCore.App package, until NuGet // generates .props and .targets files for tool restores (https://github.com/NuGet/Home/issues/5037) @@ -364,7 +373,13 @@ namespace Microsoft.DotNet.Cli.Utils // will think the deps file is up-to-date and skip executing File.Delete(tempDepsFile); - var result = new MSBuildForwardingAppWithoutLogging(args).Execute(); + var msBuildExePath = _environment.GetEnvironmentVariable(Constants.MSBUILD_EXE_PATH); + + msBuildExePath = string.IsNullOrEmpty(msBuildExePath) ? + Path.Combine(AppContext.BaseDirectory, "MSBuild.dll") : + msBuildExePath; + + var result = new MSBuildForwardingAppWithoutLogging(args, msBuildExePath).Execute(); if (result != 0) { diff --git a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs index 8a3e20014..4667dd19b 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs +++ b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs @@ -61,6 +61,8 @@ namespace Microsoft.DotNet.Cli.Utils public const string UnableToGenerateDepsJson = "unable to generate deps.json, it may have been already generated: {0}"; + public const string DepsJsonGeneratorProjectNotSet = "Unable to find deps.json generator project."; + public const string UnableToDeleteTemporaryDepsJson = "unable to delete temporary deps.json file: {0}"; public const string VersionForPackageCouldNotBeResolved = "Version for package `{0}` could not be resolved."; diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 938ad5075..a621e02bb 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -281,7 +281,8 @@ namespace Microsoft.DotNet.Tests lockFile, s_toolPackageFramework, depsJsonFile, - new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty())); + new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty()), + GetToolDepsJsonGeneratorProject()); File.ReadAllText(depsJsonFile).Should().Be("temp"); File.Delete(depsJsonFile); @@ -456,5 +457,12 @@ namespace Microsoft.DotNet.Tests return projectToolsCommandResolver; } + + private string GetToolDepsJsonGeneratorProject() + { + // When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing + // we'll hard code the path inside the SDK since we don't have a project to evaluate here + return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, @"Sdks\Microsoft.NET.Sdk\build\GenerateDeps\GenerateDeps.proj"); + } } } diff --git a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs index 41622c72f..51e7017b1 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs @@ -14,6 +14,8 @@ using NuGet.Protocol; using Xunit; using Xunit.Abstractions; using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand; +using System.Diagnostics; +using System.Threading; namespace Microsoft.DotNet.Cli.MSBuild.Tests { @@ -164,11 +166,16 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty()); - FieldInfo forwardingAppFieldInfo = msBuildForwardingApp + object forwardingAppWithoutLogging = msBuildForwardingApp + .GetType() + .GetField("_forwardingAppWithoutLogging", BindingFlags.Instance | BindingFlags.NonPublic) + ?.GetValue(msBuildForwardingApp); + + FieldInfo forwardingAppFieldInfo = forwardingAppWithoutLogging .GetType() .GetField("_forwardingApp", BindingFlags.Instance | BindingFlags.NonPublic); - ForwardingApp forwardingApp = forwardingAppFieldInfo?.GetValue(msBuildForwardingApp) as ForwardingApp; + object forwardingApp = forwardingAppFieldInfo?.GetValue(forwardingAppWithoutLogging); FieldInfo allArgsFieldinfo = forwardingApp? .GetType() From ea7d84fbcae7e7aa9c024288a255b8dfa14221ea Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 24 Apr 2017 10:59:13 -0700 Subject: [PATCH 05/68] Remove unnecessary RuntimeFrameworkVersion and DotnetCliToolTargetFramework from test assets --- TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj | 1 - .../AppThrowingException/App/AppThrowingException.csproj | 1 - .../AppDependingOnOtherAsTool.csproj | 2 -- .../AppWithNonExistingToolDependency.csproj | 1 - .../AppWithDepOnTool/AppWithDepOnTool.csproj | 2 -- .../ToolWithRandomPackageName.csproj | 1 - .../TestPackages/ToolWithOutputName/ToolWithOutputName.csproj | 1 - .../dotnet-fallbackfoldertool.csproj | 1 - .../dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj | 1 - .../dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj | 1 - .../TestPackages/dotnet-portable/dotnet-portable.csproj | 1 - .../dotnet-prefercliruntime/dotnet-prefercliruntime.csproj | 1 - .../AppWithDepOnToolWithOutputName.csproj | 2 -- .../AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj | 2 -- .../TestProjects/AppWithDirectDep/AppWithDirectDep.csproj | 2 -- .../AppWithDirectDepWithOutputName.csproj | 1 - .../AppWithFallbackFolderToolDependency.csproj | 2 -- .../AppWithToolDependency/AppWithToolDependency.csproj | 2 -- .../DependencyContextFromTool.csproj | 1 - .../MSBuildAppWithMultipleFrameworks.csproj | 1 - TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj | 2 -- TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj | 1 - .../TestAppWithProjDepTool/TestAppWithProjDepTool.csproj | 1 - .../VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj | 4 ---- .../TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj | 1 - .../VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj | 1 - 26 files changed, 37 deletions(-) diff --git a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj index ba40187cd..27d4b3c4d 100644 --- a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj +++ b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj @@ -6,7 +6,6 @@ Exe $(PackageTargetFallback);portable-net45+win8;dnxcore50 win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 - $(CLI_SharedFrameworkVersion) netcoreapp1.1 diff --git a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj index d705ebd65..f595af9f3 100644 --- a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj +++ b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj @@ -6,7 +6,6 @@ netcoreapp1.0 dotnet-throwingtool $(AssemblyName) - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj b/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj index 7159443c2..30c6823e7 100644 --- a/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj +++ b/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj @@ -4,8 +4,6 @@ Exe netcoreapp2.0 - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/NonRestoredTestProjects/AppWithNonExistingToolDependency/AppWithNonExistingToolDependency.csproj b/TestAssets/NonRestoredTestProjects/AppWithNonExistingToolDependency/AppWithNonExistingToolDependency.csproj index 11553b268..db9d6f117 100644 --- a/TestAssets/NonRestoredTestProjects/AppWithNonExistingToolDependency/AppWithNonExistingToolDependency.csproj +++ b/TestAssets/NonRestoredTestProjects/AppWithNonExistingToolDependency/AppWithNonExistingToolDependency.csproj @@ -4,7 +4,6 @@ Exe netcoreapp2.0 - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj index f62de8419..f5ab2f51a 100644 --- a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj +++ b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj @@ -5,8 +5,6 @@ Exe netcoreapp2.0 random-name - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj index 3cbeb2a34..9184414e8 100644 --- a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj +++ b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj @@ -7,7 +7,6 @@ random-name $(GeneratedPackageId) dotnet-randompackage - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj index 4844d4232..5639e3331 100644 --- a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj +++ b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj @@ -6,7 +6,6 @@ dotnet-tool-with-output-name ToolWithOutputName Exe - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj index b7049a0ca..11aac9cf0 100644 --- a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj +++ b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj @@ -6,7 +6,6 @@ dotnet-fallbackfoldertool Exe - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj index 8a5096465..fd5621f08 100644 --- a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj +++ b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj @@ -6,7 +6,6 @@ netcoreapp2.0 - $(CLI_SharedFrameworkVersion) dotnet-hello Exe win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 diff --git a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj index 8f8164cef..2391dfc1b 100644 --- a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj +++ b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj @@ -6,7 +6,6 @@ netcoreapp2.0 - $(CLI_SharedFrameworkVersion) dotnet-hello Exe win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj index 6ec578ca4..cfbee8a50 100644 --- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj +++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj @@ -6,7 +6,6 @@ dotnet-portable Exe - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj index 9b9f2fec9..bd65e4cdd 100644 --- a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj +++ b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj @@ -5,7 +5,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj b/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj index c1d0bb41a..9adf4c6fc 100755 --- a/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj +++ b/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj @@ -4,8 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj index 8795839bc..df284421b 100755 --- a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj +++ b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj @@ -4,8 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj b/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj index 0ca6ef86f..6995199ee 100755 --- a/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj +++ b/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj @@ -7,8 +7,6 @@ AppWithDirectDep Exe false - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj index 4f189d465..60a496f1e 100755 --- a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj +++ b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj @@ -4,7 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) netcoreapp1.1 diff --git a/TestAssets/TestProjects/AppWithFallbackFolderToolDependency/AppWithFallbackFolderToolDependency.csproj b/TestAssets/TestProjects/AppWithFallbackFolderToolDependency/AppWithFallbackFolderToolDependency.csproj index 706240e90..705cf2077 100755 --- a/TestAssets/TestProjects/AppWithFallbackFolderToolDependency/AppWithFallbackFolderToolDependency.csproj +++ b/TestAssets/TestProjects/AppWithFallbackFolderToolDependency/AppWithFallbackFolderToolDependency.csproj @@ -4,8 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj b/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj index f3506fae4..7f9c16848 100755 --- a/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj +++ b/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj @@ -4,8 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj index 909f6aa9f..3a74bcca2 100755 --- a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj +++ b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj @@ -8,7 +8,6 @@ Exe false $(PackageTargetFallback);dnxcore50;portable-net45+win8 - $(CLI_SharedFrameworkVersion) netcoreapp1.1 diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj index 255d7f570..89aae6c65 100644 --- a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj @@ -4,7 +4,6 @@ Exe net451;netcoreapp2.0 - $(CLI_SharedFrameworkVersion) \ No newline at end of file diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj index 1f9b629d4..79bceb82d 100644 --- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj +++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj @@ -5,8 +5,6 @@ Exe netcoreapp2.0 win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 - $(CLI_SharedFrameworkVersion) - netcoreapp2.0 diff --git a/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj b/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj index 4f0d4e8e5..302abe3bc 100755 --- a/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj +++ b/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj @@ -4,7 +4,6 @@ netcoreapp2.0 Exe - $(CLI_SharedFrameworkVersion) true diff --git a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj index bedcf3da2..ee366323a 100644 --- a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj +++ b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj @@ -4,7 +4,6 @@ Exe netcoreapp2.0 - $(CLI_SharedFrameworkVersion) netcoreapp1.1 diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj index 84252d545..9cd7184f8 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj @@ -10,10 +10,6 @@ DESKTOP;$(DefineConstants) - - $(CLI_SharedFrameworkVersion) - - diff --git a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj index 711143c68..0d07738af 100644 --- a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj @@ -4,7 +4,6 @@ Exe netcoreapp2.0 - $(CLI_SharedFrameworkVersion) diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj index ae4226e6c..d6016beea 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj @@ -4,7 +4,6 @@ Exe netcoreapp2.0 - $(CLI_SharedFrameworkVersion) From 8615c300631eb058933c0a76bb9e78ee19d075ea Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 24 Apr 2017 23:09:45 -0700 Subject: [PATCH 06/68] Don't roll prefercliruntime tools forward across major versions of .NET Core --- ...ackagedCommandSpecFactoryWithCliRuntime.cs | 38 +++++++++++++++++-- .../LocalizableStrings.cs | 2 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs index a081bcd30..660fc1b94 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs @@ -21,11 +21,43 @@ namespace Microsoft.DotNet.Cli.Utils { if(PrefersCliRuntime(commandPath)) { - arguments.Add("--fx-version"); - arguments.Add(new Muxer().SharedFxVersion); + var runtimeConfigFile = Path.ChangeExtension(commandPath, FileNameSuffixes.RuntimeConfigJson); + var runtimeConfig = new RuntimeConfig(runtimeConfigFile); + + var muxer = new Muxer(); + + Version currentFrameworkSimpleVersion = GetVersionWithoutPrerelease(muxer.SharedFxVersion); + Version toolFrameworkSimpleVersion = GetVersionWithoutPrerelease(runtimeConfig.Framework.Version); + + if (currentFrameworkSimpleVersion.Major != toolFrameworkSimpleVersion.Major) + { + Reporter.Verbose.WriteLine( + string.Format( + LocalizableStrings.IgnoringPreferCLIRuntimeFile, + nameof(PackagedCommandSpecFactory), + runtimeConfig.Framework.Version, + muxer.SharedFxVersion)); + } + else + { + arguments.Add("--fx-version"); + arguments.Add(new Muxer().SharedFxVersion); + } } } + private static Version GetVersionWithoutPrerelease(string version) + { + int dashOrPlusIndex = version.IndexOfAny(new char[] { '-', '+' }); + + if (dashOrPlusIndex >= 0) + { + version = version.Substring(0, dashOrPlusIndex); + } + + return new Version(version); + } + private static bool PrefersCliRuntime(string commandPath) { var libTFMPackageDirectory = Path.GetDirectoryName(commandPath); @@ -35,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Utils Reporter.Verbose.WriteLine( string.Format( LocalizableStrings.LookingForPreferCliRuntimeFile, - "packagedcommandspecfactory", + nameof(PackagedCommandSpecFactory), preferCliRuntimePath)); return File.Exists(preferCliRuntimePath); diff --git a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs index 4667dd19b..455920e1b 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs +++ b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs @@ -19,6 +19,8 @@ namespace Microsoft.DotNet.Cli.Utils public const string LookingForPreferCliRuntimeFile = "{0}: Looking for prefercliruntime file at `{1}`"; + public const string IgnoringPreferCLIRuntimeFile = "{0}: Ignoring prefercliruntime file as the tool target framework ({1}) has a different major version than the current CLI runtime ({2})"; + public const string AttemptingToResolve = "{0}: attempting to resolve {1}"; public const string DidNotFindAMatchingProject = "{0}: Did not find a matching project {1}."; From 01d3895b24409dbe1f7867a3179420a7d723f4c4 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 25 Apr 2017 10:03:45 -0700 Subject: [PATCH 07/68] Add tests for behavior of tools that target previous major version of shared framework --- .../dotnet-portable-v1-prefercli.csproj | 23 ++++++ .../dotnet-portable-v1.csproj | 18 +++++ .../TestPackages/dotnet-portable/Program.cs | 8 ++ .../dotnet-portable/dotnet-portable.csproj | 2 - build/test/TestPackageProjects.targets | 18 +++++ ...equiresSpecificFrameworkTheoryAttribute.cs | 19 +++++ test/dotnet.Tests/PackagedCommandTests.cs | 76 +++++++++++++++++++ 7 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj create mode 100644 TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj create mode 100644 test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs diff --git a/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj new file mode 100644 index 000000000..60ef7f71c --- /dev/null +++ b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj @@ -0,0 +1,23 @@ + + + + + netcoreapp1.1 + Exe + + + + + $(ProjectRuntimeConfigFilePath) + + + + + + + + true + \prefercliruntime + + + diff --git a/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj new file mode 100644 index 000000000..3df959be1 --- /dev/null +++ b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj @@ -0,0 +1,18 @@ + + + + + netcoreapp1.1 + Exe + + + + + $(ProjectRuntimeConfigFilePath) + + + + + + + diff --git a/TestAssets/TestPackages/dotnet-portable/Program.cs b/TestAssets/TestPackages/dotnet-portable/Program.cs index bcb5ed009..d0e978fd2 100644 --- a/TestAssets/TestPackages/dotnet-portable/Program.cs +++ b/TestAssets/TestPackages/dotnet-portable/Program.cs @@ -2,6 +2,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.IO; +using System.Reflection; namespace ConsoleApplication { @@ -10,6 +12,12 @@ namespace ConsoleApplication public static void Main(string[] args) { Console.WriteLine("Hello Portable World!"); + + var coreAssembly = typeof(object).GetTypeInfo().Assembly; + string coreFolder = Path.GetDirectoryName(coreAssembly.Location); + string frameworkVersion = Path.GetFileName(coreFolder); + + Console.WriteLine($"I'm running on shared framework version {frameworkVersion}!"); } } } diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj index cfbee8a50..f8b581110 100644 --- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj +++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj @@ -3,9 +3,7 @@ netcoreapp2.0 - dotnet-portable Exe - diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index 986fc569a..610d03937 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -136,6 +136,24 @@ True + + dotnet-portable + dotnet-portable-v1.csproj + True + True + 1.0.0 + + True + + + dotnet-portable + dotnet-portable-v1-prefercli.csproj + True + True + 1.0.0 + + True + dotnet-fallbackfoldertool dotnet-fallbackfoldertool.csproj diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs new file mode 100644 index 000000000..c2af978d4 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs @@ -0,0 +1,19 @@ +using Microsoft.DotNet.Tools.Test.Utilities; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public class RequiresSpecificFrameworkTheoryAttribute : TheoryAttribute + { + public RequiresSpecificFrameworkTheoryAttribute(string framework) + { + if (!EnvironmentInfo.HasSharedFramework(framework)) + { + this.Skip = $"This test requires a shared framework that isn't present: {framework}"; + } + } + } +} diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index e1816ca8f..642ef1364 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -91,6 +91,82 @@ namespace Microsoft.DotNet.Tests .And.Pass(); } + [Theory] + [InlineData(true)] + [InlineData(false)] + public void IfPreviousVersionOfSharedFrameworkIsNotInstalled_ToolsTargetingItFail(bool toolPrefersCLIRuntime) + { + var testInstance = TestAssets.Get("AppWithToolDependency") + .CreateInstance(identifier: toolPrefersCLIRuntime ? "preferCLIRuntime" : "") + .WithSourceFiles() + .WithNuGetConfig(new RepoDirectoriesProvider().TestPackages); + + testInstance = testInstance.WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + + var toolReference = project.Descendants(ns + "DotNetCliToolReference") + .Where(tr => tr.Attribute("Include").Value == "dotnet-portable") + .Single(); + + toolReference.Attribute("Include").Value = + toolPrefersCLIRuntime ? "dotnet-portable-v1-prefercli" : "dotnet-portable-v1"; + }); + + testInstance = testInstance.WithRestoreFiles(); + + new BuildCommand() + .WithProjectDirectory(testInstance.Root) + .Execute() + .Should().Pass(); + + new GenericCommand(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1") + .WithWorkingDirectory(testInstance.Root) + .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") + .Execute() + .Should().Fail(); + } + + [RequiresSpecificFrameworkTheory("netcoreapp1.1")] + [InlineData(true)] + [InlineData(false)] + public void IfPreviousVersionOfSharedFrameworkIsInstalled_ToolsTargetingItRun(bool toolPrefersCLIRuntime) + { + var testInstance = TestAssets.Get("AppWithToolDependency") + .CreateInstance(identifier: toolPrefersCLIRuntime ? "preferCLIRuntime" : "") + .WithSourceFiles() + .WithNuGetConfig(new RepoDirectoriesProvider().TestPackages); + + testInstance = testInstance.WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + + var toolReference = project.Descendants(ns + "DotNetCliToolReference") + .Where(tr => tr.Attribute("Include").Value == "dotnet-portable") + .Single(); + + toolReference.Attribute("Include").Value = + toolPrefersCLIRuntime ? "dotnet-portable-v1-prefercli" : "dotnet-portable-v1"; + }); + + testInstance = testInstance.WithRestoreFiles(); + + new BuildCommand() + .WithProjectDirectory(testInstance.Root) + .Execute() + .Should().Pass(); + + var result = + new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) + .WithWorkingDirectory(testInstance.Root) + .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") + .Execute(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1"); + + result.Should().Pass() + .And.HaveStdOutContaining("I'm running on shared framework version 1.1.1!"); + + } + [Fact] public void CanInvokeToolWhosePackageNameIsDifferentFromDllName() { From 06c1cc5990c11e597e596cbb8c04962030e4b29b Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 25 Apr 2017 11:20:37 -0700 Subject: [PATCH 08/68] Update test tools that need conflict resolution on 2.0 to target 2.0 --- .../DesktopTestProjects/AppWithProjTool2Fx/App.csproj | 1 - .../AppWithRedirectsAndConfig.csproj | 1 - .../AppWithRedirectsNoConfig.csproj | 1 - .../DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj | 1 - .../dotnet-dependency-context-test.csproj | 8 ++------ .../dotnet-dependency-tool-invoker.csproj | 8 ++------ .../AppWithDirectDepWithOutputName.csproj | 1 - .../MSBuildAppWithMultipleFrameworksAndTools.csproj | 1 - .../DependencyContextFromTool.csproj | 1 - .../MSBuildAppWithMultipleFrameworksAndTools.csproj | 1 - .../TestAppWithProjDepTool/TestAppWithProjDepTool.csproj | 1 - test/EndToEnd/GivenDotNetUsesMSBuild.cs | 2 +- test/dotnet.Tests/PackagedCommandTests.cs | 4 ++-- 13 files changed, 7 insertions(+), 24 deletions(-) diff --git a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj index 27d4b3c4d..f52962bc8 100644 --- a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj +++ b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj @@ -6,7 +6,6 @@ Exe $(PackageTargetFallback);portable-net45+win8;dnxcore50 win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 - netcoreapp1.1 diff --git a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj index 9ab6d1e5a..82a5ad25d 100644 --- a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj +++ b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj @@ -4,7 +4,6 @@ AppWithRedirectsAndConfig Exe win7-x64;win7-x86 - netcoreapp1.1 diff --git a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj index aa1b27d15..94b99d56b 100644 --- a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj +++ b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj @@ -4,7 +4,6 @@ AppWithRedirectsNoConfig Exe win7-x64;win7-x86 - netcoreapp1.1 diff --git a/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj b/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj index 51192f708..e0865b59b 100644 --- a/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj +++ b/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj @@ -3,7 +3,6 @@ netstandard1.6;net451 Library $(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp2.0 - netcoreapp1.1 diff --git a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj index 1717cd460..85afeaf74 100644 --- a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj @@ -1,14 +1,10 @@  - + 1.0.0-rc - netcoreapp1.1 - dotnet-dependency-context-test + netcoreapp2.0 Exe - $(PackageTargetFallback);dnxcore50;portable-net45+win8 - 1.1.1 - false diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 23df5a2ee..35b569560 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -1,15 +1,11 @@  - + 1.0.0-rc - netcoreapp1.1 - dotnet-dependency-tool-invoker + netcoreapp2.0 Exe - $(PackageTargetFallback);portable-net45+win8;dnxcore50 - 1.1.1 - false diff --git a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj index 60a496f1e..5afb24921 100755 --- a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj +++ b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj @@ -4,7 +4,6 @@ netcoreapp2.0 Exe - netcoreapp1.1 diff --git a/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj b/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj index db7004ecd..33cb2b5a7 100644 --- a/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj +++ b/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj @@ -4,7 +4,6 @@ Exe net451;netcoreapp2.0 - netcoreapp1.1 diff --git a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj index 3a74bcca2..5dfd70f43 100755 --- a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj +++ b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj @@ -8,7 +8,6 @@ Exe false $(PackageTargetFallback);dnxcore50;portable-net45+win8 - netcoreapp1.1 diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj index 5c26acade..766c1ae66 100644 --- a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj @@ -4,7 +4,6 @@ Exe net451;netcoreapp2.0 - netcoreapp1.1 diff --git a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj index ee366323a..3f8176791 100644 --- a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj +++ b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj @@ -4,7 +4,6 @@ Exe netcoreapp2.0 - netcoreapp1.1 diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index 86d19e0c3..f714ee38c 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -89,7 +89,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd .And.HaveStdOutContaining("Hello I prefer the cli runtime World!");; } - [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 + [Fact] public void ItCanRunAToolThatInvokesADependencyToolInACSProj() { var repoDirectoriesProvider = new RepoDirectoriesProvider(); diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index 642ef1364..e0f1cd2c5 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -188,7 +188,7 @@ namespace Microsoft.DotNet.Tests .And.Pass(); } - [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 + [Fact] public void CanInvokeToolFromDirectDependenciesIfPackageNameDifferentFromToolName() { var testInstance = TestAssets.Get("AppWithDirectDepWithOutputName") @@ -318,7 +318,7 @@ namespace Microsoft.DotNet.Tests .Should().Fail(); } - [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 + [Fact] public void ToolsCanAccessDependencyContextProperly() { var testInstance = TestAssets.Get("DependencyContextFromTool") From cc9e942ede3df06c70fc3a25613e85cc071f189d Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 26 Apr 2017 14:57:18 -0700 Subject: [PATCH 09/68] Apply code review feedback --- TestAssets/TestPackages/dotnet-portable/Program.cs | 14 +++++++++++--- .../IPackagedCommandSpecFactory.cs | 2 -- .../PackagedCommandSpecFactoryWithCliRuntime.cs | 2 +- .../Extensions/LockFileExtensions.cs | 5 ++++- .../ForwardingAppImplementation.cs | 4 ++-- .../MSBuildForwardingAppWithoutLogging.cs | 5 ++++- src/dotnet/ForwardingApp.cs | 7 +++++-- .../dotnet-msbuild/MSBuildForwardingApp.cs | 2 +- .../GivenAProjectToolsCommandResolver.cs | 2 +- .../RequiresSpecificFrameworkTheoryAttribute.cs | 5 ++++- 10 files changed, 33 insertions(+), 15 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-portable/Program.cs b/TestAssets/TestPackages/dotnet-portable/Program.cs index d0e978fd2..1c8fb26e7 100644 --- a/TestAssets/TestPackages/dotnet-portable/Program.cs +++ b/TestAssets/TestPackages/dotnet-portable/Program.cs @@ -13,11 +13,19 @@ namespace ConsoleApplication { Console.WriteLine("Hello Portable World!"); - var coreAssembly = typeof(object).GetTypeInfo().Assembly; - string coreFolder = Path.GetDirectoryName(coreAssembly.Location); - string frameworkVersion = Path.GetFileName(coreFolder); + var depsFile = new FileInfo(GetDataFromAppDomain("FX_DEPS_FILE")); + string frameworkVersion = depsFile.Directory.Name; Console.WriteLine($"I'm running on shared framework version {frameworkVersion}!"); } + + public static string GetDataFromAppDomain(string propertyName) + { + var appDomainType = typeof(object).GetTypeInfo().Assembly?.GetType("System.AppDomain"); + var currentDomain = appDomainType?.GetProperty("CurrentDomain")?.GetValue(null); + var deps = appDomainType?.GetMethod("GetData")?.Invoke(currentDomain, new[] { propertyName }); + + return deps as string; + } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs index 15ed9fde5..5f409a09f 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IPackagedCommandSpecFactory.cs @@ -8,8 +8,6 @@ namespace Microsoft.DotNet.Cli.Utils { public interface IPackagedCommandSpecFactory { - // Code review TODO: Is it OK to make breaking changes to the CLI Utils API surface? - CommandSpec CreateCommandSpecFromLibrary( LockFileTargetLibrary toolLibrary, string commandName, diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs index 660fc1b94..0d7edc4e3 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs @@ -41,7 +41,7 @@ namespace Microsoft.DotNet.Cli.Utils else { arguments.Add("--fx-version"); - arguments.Add(new Muxer().SharedFxVersion); + arguments.Add(muxer.SharedFxVersion); } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs index 5b504badf..a54a502a9 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs @@ -1,4 +1,7 @@ -using Microsoft.DotNet.Tools.Common; +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.Tools.Common; using NuGet.Packaging; using NuGet.ProjectModel; using System; diff --git a/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs b/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs index cb5098bc0..72e65aa3c 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Utils /// internal class ForwardingAppImplementation { - private const string s_hostExe = "dotnet"; + private const string HostExe = "dotnet"; private readonly string _forwardApplicationPath; private readonly IEnumerable _argsToForward; @@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Utils private string GetHostExeName() { - return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}"; + return $"{HostExe}{FileNameSuffixes.CurrentPlatform.Exe}"; } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs index 552befdab..351ce43af 100644 --- a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs +++ b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/src/dotnet/ForwardingApp.cs b/src/dotnet/ForwardingApp.cs index 6b44c650e..25d3cff58 100644 --- a/src/dotnet/ForwardingApp.cs +++ b/src/dotnet/ForwardingApp.cs @@ -1,4 +1,7 @@ -using Microsoft.DotNet.Cli.Utils; +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.Cli.Utils; using System; using System.Collections.Generic; using System.Diagnostics; @@ -8,7 +11,7 @@ namespace Microsoft.DotNet.Cli { public class ForwardingApp { - ForwardingAppImplementation _implementation; + private ForwardingAppImplementation _implementation; public ForwardingApp( string forwardApplicationPath, diff --git a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs index c4e42fe2d..b3edf4abe 100644 --- a/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs +++ b/src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs @@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Tools.MSBuild private MSBuildForwardingAppWithoutLogging _forwardingAppWithoutLogging; - static IEnumerable ConcatTelemetryLogger(IEnumerable argsToForward) + private static IEnumerable ConcatTelemetryLogger(IEnumerable argsToForward) { if (Telemetry.CurrentSessionId != null) { diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index a621e02bb..11eca166a 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -462,7 +462,7 @@ namespace Microsoft.DotNet.Tests { // When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing // we'll hard code the path inside the SDK since we don't have a project to evaluate here - return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, @"Sdks\Microsoft.NET.Sdk\build\GenerateDeps\GenerateDeps.proj"); + return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "Sdks", "Microsoft.NET.Sdk", "build", "GenerateDeps", "GenerateDeps.proj"); } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs index c2af978d4..52166156b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkTheoryAttribute.cs @@ -1,4 +1,7 @@ -using Microsoft.DotNet.Tools.Test.Utilities; +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.Tools.Test.Utilities; using System; using System.Collections.Generic; using System.Text; From 4bf34512f854931ff66cdbef604103b2dd259e7b Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 26 Apr 2017 14:57:46 -0700 Subject: [PATCH 10/68] Fix test asset which depends on SdkNuGetVersion property --- .../dotnet-dependency-tool-invoker.csproj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 35b569560..2ce9e3b1a 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -1,11 +1,15 @@  - + + + 1.0.0-rc netcoreapp2.0 Exe + false From 0afd0b997525a86b6c60a5dea749e2c9ef49439e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 26 Apr 2017 15:41:23 -0700 Subject: [PATCH 11/68] Remove dead code --- .../CommandResolution/DepsJsonBuilder.cs | 315 ------------------ .../ProjectToolsCommandResolver.cs | 3 - 2 files changed, 318 deletions(-) delete mode 100644 src/Microsoft.DotNet.Cli.Utils/CommandResolution/DepsJsonBuilder.cs diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DepsJsonBuilder.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DepsJsonBuilder.cs deleted file mode 100644 index c9a69f0c8..000000000 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DepsJsonBuilder.cs +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using Microsoft.Extensions.DependencyModel; -using NuGet.Frameworks; -using NuGet.Packaging; -using NuGet.Packaging.Core; -using NuGet.ProjectModel; - -namespace Microsoft.DotNet.Cli.Utils -{ - internal class DepsJsonBuilder - { - private readonly VersionFolderPathResolver _versionFolderPathResolver; - - public DepsJsonBuilder() - { - // This resolver is only used for building file names, so that base path is not required. - _versionFolderPathResolver = new VersionFolderPathResolver(rootPath: null); - } - - public DependencyContext Build( - SingleProjectInfo mainProjectInfo, - CompilationOptions compilationOptions, - LockFile lockFile, - NuGetFramework framework, - string runtime) - { - bool includeCompilationLibraries = compilationOptions != null; - - LockFileTarget lockFileTarget = lockFile.GetTarget(framework, runtime); - - IEnumerable runtimeExports = lockFileTarget.GetRuntimeLibraries(); - IEnumerable compilationExports = - includeCompilationLibraries ? - lockFileTarget.GetCompileLibraries() : - Enumerable.Empty(); - - var dependencyLookup = compilationExports - .Concat(runtimeExports) - .Distinct() - .Select(library => new Dependency(library.Name, library.Version.ToString())) - .ToDictionary(dependency => dependency.Name, StringComparer.OrdinalIgnoreCase); - - var libraryLookup = lockFile.Libraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase); - - var runtimeSignature = GenerateRuntimeSignature(runtimeExports); - - IEnumerable runtimeLibraries = - GetLibraries(runtimeExports, libraryLookup, dependencyLookup, runtime: true).Cast(); - - IEnumerable compilationLibraries; - if (includeCompilationLibraries) - { - CompilationLibrary projectCompilationLibrary = GetProjectCompilationLibrary( - mainProjectInfo, - lockFile, - lockFileTarget, - dependencyLookup); - compilationLibraries = new[] { projectCompilationLibrary } - .Concat( - GetLibraries(compilationExports, libraryLookup, dependencyLookup, runtime: false) - .Cast()); - } - else - { - compilationLibraries = Enumerable.Empty(); - } - - return new DependencyContext( - new TargetInfo(framework.DotNetFrameworkName, runtime, runtimeSignature, lockFileTarget.IsPortable()), - compilationOptions ?? CompilationOptions.Default, - compilationLibraries, - runtimeLibraries, - new RuntimeFallbacks[] { }); - } - - private static string GenerateRuntimeSignature(IEnumerable runtimeExports) - { - var sha1 = SHA1.Create(); - var builder = new StringBuilder(); - var packages = runtimeExports - .Where(libraryExport => libraryExport.Type == "package"); - var separator = "|"; - foreach (var libraryExport in packages) - { - builder.Append(libraryExport.Name); - builder.Append(separator); - builder.Append(libraryExport.Version.ToString()); - builder.Append(separator); - } - var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(builder.ToString())); - - builder.Clear(); - foreach (var hashByte in hash) - { - builder.AppendFormat("{0:x2}", hashByte); - } - return builder.ToString(); - } - - private List GetProjectDependencies( - LockFile lockFile, - LockFileTarget lockFileTarget, - Dictionary dependencyLookup) - { - - List dependencies = new List(); - - IEnumerable projectFileDependencies = lockFile - .ProjectFileDependencyGroups - .Where(dg => dg.FrameworkName == string.Empty || - dg.FrameworkName == lockFileTarget.TargetFramework.DotNetFrameworkName); - - foreach (string projectFileDependency in projectFileDependencies.SelectMany(dg => dg.Dependencies)) - { - int separatorIndex = projectFileDependency.IndexOf(' '); - string dependencyName = separatorIndex > 0 ? - projectFileDependency.Substring(0, separatorIndex) : - projectFileDependency; - - Dependency dependency; - if (dependencyLookup.TryGetValue(dependencyName, out dependency)) - { - dependencies.Add(dependency); - } - } - - return dependencies; - } - - private RuntimeLibrary GetProjectRuntimeLibrary( - SingleProjectInfo projectInfo, - LockFile lockFile, - LockFileTarget lockFileTarget, - Dictionary dependencyLookup) - { - - RuntimeAssetGroup[] runtimeAssemblyGroups = new[] { new RuntimeAssetGroup(string.Empty, projectInfo.GetOutputName()) }; - - List dependencies = GetProjectDependencies(lockFile, lockFileTarget, dependencyLookup); - - ResourceAssembly[] resourceAssemblies = projectInfo - .ResourceAssemblies - .Select(r => new ResourceAssembly(r.RelativePath, r.Culture)) - .ToArray(); - - return new RuntimeLibrary( - type: "project", - name: projectInfo.Name, - version: projectInfo.Version, - hash: string.Empty, - runtimeAssemblyGroups: runtimeAssemblyGroups, - nativeLibraryGroups: new RuntimeAssetGroup[] { }, - resourceAssemblies: resourceAssemblies, - dependencies: dependencies.ToArray(), - serviceable: false); - } - - private CompilationLibrary GetProjectCompilationLibrary( - SingleProjectInfo projectInfo, - LockFile lockFile, - LockFileTarget lockFileTarget, - Dictionary dependencyLookup) - { - List dependencies = GetProjectDependencies(lockFile, lockFileTarget, dependencyLookup); - - return new CompilationLibrary( - type: "project", - name: projectInfo.Name, - version: projectInfo.Version, - hash: string.Empty, - assemblies: new[] { projectInfo.GetOutputName() }, - dependencies: dependencies.ToArray(), - serviceable: false); - } - - private IEnumerable GetLibraries( - IEnumerable exports, - IDictionary libraryLookup, - IDictionary dependencyLookup, - bool runtime) - { - return exports.Select(export => GetLibrary(export, libraryLookup, dependencyLookup, runtime)); - } - - private Library GetLibrary( - LockFileTargetLibrary export, - IDictionary libraryLookup, - IDictionary dependencyLookup, - bool runtime) - { - var type = export.Type; - - // TEMPORARY: All packages are serviceable in RC2 - // See https://github.com/dotnet/cli/issues/2569 - var serviceable = export.Type == "package"; - var libraryDependencies = new HashSet(); - - foreach (PackageDependency libraryDependency in export.Dependencies) - { - Dependency dependency; - if (dependencyLookup.TryGetValue(libraryDependency.Id, out dependency)) - { - libraryDependencies.Add(dependency); - } - } - - string hash = string.Empty; - string path = null; - string hashPath = null; - LockFileLibrary library; - if (libraryLookup.TryGetValue(export.Name, out library)) - { - if (!string.IsNullOrEmpty(library.Sha512)) - { - hash = "sha512-" + library.Sha512; - hashPath = _versionFolderPathResolver.GetHashFileName(export.Name, export.Version); - } - - path = library.Path; - } - - if (runtime) - { - return new RuntimeLibrary( - type.ToLowerInvariant(), - export.Name, - export.Version.ToString(), - hash, - CreateRuntimeAssemblyGroups(export), - CreateNativeLibraryGroups(export), - export.ResourceAssemblies.FilterPlaceHolderFiles().Select(CreateResourceAssembly), - libraryDependencies, - serviceable, - path, - hashPath); - } - else - { - IEnumerable assemblies = export - .CompileTimeAssemblies - .FilterPlaceHolderFiles() - .Select(libraryAsset => libraryAsset.Path); - - return new CompilationLibrary( - type.ToString().ToLowerInvariant(), - export.Name, - export.Version.ToString(), - hash, - assemblies, - libraryDependencies, - serviceable, - path, - hashPath); - } - } - - private IReadOnlyList CreateRuntimeAssemblyGroups(LockFileTargetLibrary export) - { - List assemblyGroups = new List(); - - assemblyGroups.Add( - new RuntimeAssetGroup( - string.Empty, - export.RuntimeAssemblies.FilterPlaceHolderFiles().Select(a => a.Path))); - - foreach (var runtimeTargetsGroup in export.GetRuntimeTargetsGroups("runtime")) - { - assemblyGroups.Add( - new RuntimeAssetGroup( - runtimeTargetsGroup.Key, - runtimeTargetsGroup.Select(t => t.Path))); - } - - return assemblyGroups; - } - - private IReadOnlyList CreateNativeLibraryGroups(LockFileTargetLibrary export) - { - List nativeGroups = new List(); - - nativeGroups.Add( - new RuntimeAssetGroup( - string.Empty, - export.NativeLibraries.FilterPlaceHolderFiles().Select(a => a.Path))); - - foreach (var runtimeTargetsGroup in export.GetRuntimeTargetsGroups("native")) - { - nativeGroups.Add( - new RuntimeAssetGroup( - runtimeTargetsGroup.Key, - runtimeTargetsGroup.Select(t => t.Path))); - } - - return nativeGroups; - } - - private ResourceAssembly CreateResourceAssembly(LockFileItem resourceAssembly) - { - string locale; - if (!resourceAssembly.Properties.TryGetValue("locale", out locale)) - { - locale = null; - } - - return new ResourceAssembly(resourceAssembly.Path, locale); - } - } -} diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index 41688de82..6f20e15ac 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -326,9 +326,6 @@ namespace Microsoft.DotNet.Cli.Utils LocalizableStrings.GeneratingDepsJson, depsPath)); - var dependencyContext = new DepsJsonBuilder() - .Build(toolLibrary, null, toolLockFile, framework, null); - var tempDepsFile = Path.GetTempFileName(); var args = new List(); From d471037ce304133866526ae331b11da74fc1a1d9 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 26 Apr 2017 17:59:08 -0700 Subject: [PATCH 12/68] Show error if tools package doesn't include runtimeconfig file For test assets, don't explicitly include the runtimeconfig file, as the pack command does it automatically --- .../ToolWithOutputName/ToolWithOutputName.csproj | 6 ------ .../dotnet-dependency-context-test.csproj | 6 ------ .../dotnet-dependency-tool-invoker.csproj | 6 ------ .../dotnet-desktop-and-portable.csproj | 6 ------ .../dotnet-fallbackfoldertool.csproj | 7 +------ .../dotnet-outputsframeworkversion-netcoreapp1.0.csproj | 5 ----- .../dotnet-portable-v1-prefercli.csproj | 5 ----- .../dotnet-portable-v1/dotnet-portable-v1.csproj | 6 ------ .../TestPackages/dotnet-portable/dotnet-portable.csproj | 5 ----- .../dotnet-prefercliruntime.csproj | 4 ---- .../PackagedCommandSpecFactoryWithCliRuntime.cs | 8 ++++++++ src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs | 2 ++ 12 files changed, 11 insertions(+), 55 deletions(-) diff --git a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj index 5639e3331..6c57ebe5d 100644 --- a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj +++ b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj @@ -8,10 +8,4 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj index 85afeaf74..97e20d00d 100644 --- a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj @@ -7,12 +7,6 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 2ce9e3b1a..47539b5f0 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -20,12 +20,6 @@ - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 1f3345bf4..185ef41f0 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -9,12 +9,6 @@ win7-x64;win7-x86 - - - $(ProjectRuntimeConfigFilePath) - - - 1.1.1 diff --git a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj index 11aac9cf0..35e92a2bb 100644 --- a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj +++ b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj @@ -7,10 +7,5 @@ Exe - - - - $(ProjectRuntimeConfigFilePath) - - + diff --git a/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj b/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj index 17c0af923..e26afd464 100644 --- a/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj +++ b/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj @@ -7,9 +7,4 @@ Exe 1.1.1 - - - $(ProjectRuntimeConfigFilePath) - - diff --git a/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj index 60ef7f71c..10cc9b117 100644 --- a/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj +++ b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj @@ -14,10 +14,5 @@ - - - true - \prefercliruntime - diff --git a/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj index 3df959be1..b1bddfee9 100644 --- a/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj +++ b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj @@ -6,12 +6,6 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj index f8b581110..bc2925f73 100644 --- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj +++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj @@ -6,9 +6,4 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - diff --git a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj index bd65e4cdd..21eb0a6d1 100644 --- a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj +++ b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj @@ -8,10 +8,6 @@ - - $(ProjectRuntimeConfigFilePath) - - true \prefercliruntime diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs index 0d7edc4e3..c22af40ba 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs @@ -22,6 +22,14 @@ namespace Microsoft.DotNet.Cli.Utils if(PrefersCliRuntime(commandPath)) { var runtimeConfigFile = Path.ChangeExtension(commandPath, FileNameSuffixes.RuntimeConfigJson); + + if (!File.Exists(runtimeConfigFile)) + { + throw new GracefulException(string.Format(LocalizableStrings.CouldNotFindToolRuntimeConfigFile, + nameof(PackagedCommandSpecFactory), + Path.GetFileName(commandPath))); + } + var runtimeConfig = new RuntimeConfig(runtimeConfigFile); var muxer = new Muxer(); diff --git a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs index 455920e1b..3b2f17829 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs +++ b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs @@ -21,6 +21,8 @@ namespace Microsoft.DotNet.Cli.Utils public const string IgnoringPreferCLIRuntimeFile = "{0}: Ignoring prefercliruntime file as the tool target framework ({1}) has a different major version than the current CLI runtime ({2})"; + public const string CouldNotFindToolRuntimeConfigFile = "{0}: Could not find runtimeconfig.json file for tool {1}"; + public const string AttemptingToResolve = "{0}: attempting to resolve {1}"; public const string DidNotFindAMatchingProject = "{0}: Did not find a matching project {1}."; From 811bb94de8e3dcb9276268b42b2806032127dc51 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 26 Apr 2017 19:44:46 -0700 Subject: [PATCH 13/68] If generating deps.json fails, show MSBuild output in verbose output --- .../ProjectToolsCommandResolver.cs | 9 ++++-- .../ProcessStartInfoExtensions.cs | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index 6f20e15ac..7cd9a6113 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -376,11 +376,16 @@ namespace Microsoft.DotNet.Cli.Utils Path.Combine(AppContext.BaseDirectory, "MSBuild.dll") : msBuildExePath; - var result = new MSBuildForwardingAppWithoutLogging(args, msBuildExePath).Execute(); + var result = new MSBuildForwardingAppWithoutLogging(args, msBuildExePath) + .GetProcessStartInfo() + .ExecuteAndCaptureOutput(out string stdOut, out string stdErr); if (result != 0) { - // TODO: Can / should we show the MSBuild output if there is a failure? + Reporter.Verbose.WriteLine(string.Format( + LocalizableStrings.UnableToGenerateDepsJson, + stdOut + Environment.NewLine + stdErr)); + throw new GracefulException(string.Format(LocalizableStrings.UnableToGenerateDepsJson, toolDepsJsonGeneratorProject)); } diff --git a/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs index 0805a7b41..0d11313b9 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs @@ -25,5 +25,36 @@ namespace Microsoft.DotNet.Cli.Utils return process.ExitCode; } + + public static int ExecuteAndCaptureOutput(this ProcessStartInfo startInfo, out string stdOut, out string stdErr) + { + var outStream = new StreamForwarder().Capture(); + var errStream = new StreamForwarder().Capture(); + + startInfo.RedirectStandardOutput = true; + startInfo.RedirectStandardError = true; + + var process = new Process + { + StartInfo = startInfo + }; + + process.EnableRaisingEvents = true; + + process.Start(); + + var taskOut = outStream.BeginRead(process.StandardOutput); + var taskErr = errStream.BeginRead(process.StandardError); + + process.WaitForExit(); + + taskOut.Wait(); + taskErr.Wait(); + + stdOut = outStream.CapturedOutput; + stdErr = errStream.CapturedOutput; + + return process.ExitCode; + } } } From 0c210b6e49491c97d92b47d2e84ff62cc8f8f1db Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 27 Apr 2017 09:27:06 -0700 Subject: [PATCH 14/68] Update to SDK version with support for tools deps file generation --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index d6500a942..99e55e6d9 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.0.0-preview1-002091-00 15.2.0-preview-000093-02 2.0.0-rc4-61325-08 - 2.0.0-alpha-20170425-6 + 2.0.0-alpha-20170427-1 4.3.0-beta1-2418 1.0.0-rel-20170413-451 15.1.0-preview-20170414-04 From 1eb2489e5975b47f976a146684573d9e7365cdcd Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 26 Apr 2017 14:43:12 -0700 Subject: [PATCH 15/68] Use WixQuietExec to run command sliently Also add telemtery message to the installer --- packaging/windows/clisdk/bundle.thm | 3 +- packaging/windows/clisdk/bundle.wxl | 7 +++ packaging/windows/clisdk/dotnet.wxs | 77 +++++++++++++------------- packaging/windows/clisdk/variables.wxi | 2 + 4 files changed, 51 insertions(+), 38 deletions(-) diff --git a/packaging/windows/clisdk/bundle.thm b/packaging/windows/clisdk/bundle.thm index ac5d67618..f7f30c2aa 100644 --- a/packaging/windows/clisdk/bundle.thm +++ b/packaging/windows/clisdk/bundle.thm @@ -1,6 +1,6 @@ - #(loc.Caption) + #(loc.Caption) Segoe UI Segoe UI Segoe UI @@ -52,6 +52,7 @@ #(loc.ProgressHeader) #(loc.ProgressLabel) #(loc.OverallProgressPackageText) + #(loc.FirstTimeWelcomeMessage) diff --git a/packaging/windows/clisdk/bundle.wxl b/packaging/windows/clisdk/bundle.wxl index 52c10481e..0140bab32 100644 --- a/packaging/windows/clisdk/bundle.wxl +++ b/packaging/windows/clisdk/bundle.wxl @@ -51,4 +51,11 @@ Ready? Set? Let's go! &Do not close applications. A reboot will be required. &OK &Cancel + Welcome to .NET Core! +Learn more about .NET Core at https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +Telemetry: +The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +Configuration: +A command is running in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. + diff --git a/packaging/windows/clisdk/dotnet.wxs b/packaging/windows/clisdk/dotnet.wxs index 53dfbc94f..976bf5a55 100644 --- a/packaging/windows/clisdk/dotnet.wxs +++ b/packaging/windows/clisdk/dotnet.wxs @@ -1,45 +1,48 @@ - - - + + + - + - + - - - - - - - - - - - - + + + + + + + + + + + + + - + + + + + - + - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + diff --git a/packaging/windows/clisdk/variables.wxi b/packaging/windows/clisdk/variables.wxi index 197031f6f..d76680561 100644 --- a/packaging/windows/clisdk/variables.wxi +++ b/packaging/windows/clisdk/variables.wxi @@ -17,9 +17,11 @@ + + From 8a3225c44b718acf1d156f100ae7d8ccf4c0a39e Mon Sep 17 00:00:00 2001 From: William Li Date: Mon, 24 Apr 2017 13:47:13 -0700 Subject: [PATCH 16/68] prime cache macos Using dotnet new after pkg install --- packaging/osx/clisdk/scripts/postinstall | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packaging/osx/clisdk/scripts/postinstall b/packaging/osx/clisdk/scripts/postinstall index 690a9e989..4d69748e9 100755 --- a/packaging/osx/clisdk/scripts/postinstall +++ b/packaging/osx/clisdk/scripts/postinstall @@ -11,4 +11,7 @@ INSTALL_DESTINATION=$2 # A temporary fix for the permissions issue(s) chmod -R 755 $INSTALL_DESTINATION +# Run 'dotnet new' to trigger the first time experience to initialize the cache +$INSTALL_DESTINATION/dotnet new > /dev/null 2>&1 || true + exit 0 From af9a85fd3f3b25a0a371527e3fe611fe184c2b75 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 27 Apr 2017 12:56:28 -0700 Subject: [PATCH 17/68] Disable multilevel lookup and fix tests that were depending on .NET Core 1.0 shared framework --- .../AppThrowingException/App/AppThrowingException.csproj | 2 +- run-build.ps1 | 3 +++ run-build.sh | 4 ++++ .../GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs | 1 - test/dotnet.Tests/PackagedCommandTests.cs | 2 -- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj index f595af9f3..6fede9c95 100644 --- a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj +++ b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj @@ -3,7 +3,7 @@ Exe - netcoreapp1.0 + netcoreapp1.1 dotnet-throwingtool $(AssemblyName) diff --git a/run-build.ps1 b/run-build.ps1 index 12e7cb498..0c3ed5443 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -67,6 +67,9 @@ if (!(Test-Path $env:DOTNET_INSTALL_DIR)) # Disable first run since we want to control all package sources $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +# Don't resolve shared frameworks from user or global locations +$env:DOTNET_MULTILEVEL_LOOKUP=0 + # Enable vs test console logging $env:VSTEST_BUILD_TRACE=1 $env:VSTEST_TRACE_BUILD=1 diff --git a/run-build.sh b/run-build.sh index 801a14bc1..16cece2d1 100755 --- a/run-build.sh +++ b/run-build.sh @@ -151,6 +151,10 @@ export VSTEST_BUILD_TRACE=1 export VSTEST_TRACE_BUILD=1 DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + +# Don't resolve shared frameworks from user or global locations +DOTNET_MULTILEVEL_LOOKUP=0 + toolsLocalPath="$REPOROOT/build_tools" if [ ! -z $BOOTSTRAP_INSTALL_DIR]; then toolsLocalPath = $BOOTSTRAP_INSTALL_DIR diff --git a/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs b/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs index 30ecc1f38..50b2879e6 100644 --- a/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs +++ b/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs @@ -14,7 +14,6 @@ namespace Microsoft.DotNet.Cli.Build.Tests public class GivenThatWeWantToBeBackwardsCompatibleWith1xProjects : TestBase { [Theory] - [InlineData("netcoreapp1.0")] [InlineData("netcoreapp1.1")] public void ItRestoresBuildsAndRuns(string target) { diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index e0f1cd2c5..bb75131d5 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -122,7 +122,6 @@ namespace Microsoft.DotNet.Tests new GenericCommand(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1") .WithWorkingDirectory(testInstance.Root) - .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") .Execute() .Should().Fail(); } @@ -159,7 +158,6 @@ namespace Microsoft.DotNet.Tests var result = new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) .WithWorkingDirectory(testInstance.Root) - .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") .Execute(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1"); result.Should().Pass() From b972f8229e706757a7b60189917c8ac6d47fba9e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 27 Apr 2017 13:45:12 -0700 Subject: [PATCH 18/68] Use backwards compatible runtimes for app throwing exception tests --- .../GivenAppThrowingException.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs index e5da522f8..0ce3550cb 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs @@ -28,9 +28,9 @@ namespace Microsoft.DotNet.Cli.Utils.Tests string msg1 = "Unhandled Exception: AppThrowing.MyException: " + "Exception of type 'AppThrowing.MyException' was thrown."; string msg2 = "at AppThrowing.MyException.Main(String[] args)"; - new RunCommand() + new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) .WithWorkingDirectory(appRoot) - .ExecuteWithCapturedOutput() + .ExecuteWithCapturedOutput("run") .Should().Fail() .And.HaveStdErrContaining(msg1) .And.HaveStdErrContaining(msg2); @@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests string msg1 = "Unhandled Exception: AppThrowing.MyException: " + "Exception of type 'AppThrowing.MyException' was thrown."; string msg2 = "at AppThrowing.MyException.Main(String[] args)"; - new DotnetCommand() + new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) .WithWorkingDirectory(appWithToolDepRoot) .ExecuteWithCapturedOutput("throwingtool") .Should().Fail() From fa2a02ff0efe0918c72f354b3f9886de4b66b93e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 27 Apr 2017 13:52:48 -0700 Subject: [PATCH 19/68] Add metadata to test specifying required shared framework --- .../GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs b/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs index 50b2879e6..e41cf2c8e 100644 --- a/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs +++ b/test/dotnet-back-compat.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests { public class GivenThatWeWantToBeBackwardsCompatibleWith1xProjects : TestBase { - [Theory] + [RequiresSpecificFrameworkTheory("netcoreapp1.1")] [InlineData("netcoreapp1.1")] public void ItRestoresBuildsAndRuns(string target) { From 5454ab678033390795800e3a7d898f891e955fab Mon Sep 17 00:00:00 2001 From: William Li Date: Thu, 27 Apr 2017 13:25:57 -0700 Subject: [PATCH 20/68] Add conclusion page for telemetry notice --- packaging/osx/clisdk/Distribution-Template | 9 +++--- .../cs.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../de.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../en.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../es.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../fr.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../it.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../ja.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../ko.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../pl.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../pt-br.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../ru.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../tr.lproj/firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ .../firstTimeWelcomeMessage.html | 29 +++++++++++++++++++ 15 files changed, 410 insertions(+), 5 deletions(-) create mode 100644 packaging/osx/clisdk/resources/cs.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/de.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/en.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/es.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/fr.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/it.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/ja.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/ko.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/pl.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/pt-br.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/ru.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/tr.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/zh-hans.lproj/firstTimeWelcomeMessage.html create mode 100644 packaging/osx/clisdk/resources/zh-hant.lproj/firstTimeWelcomeMessage.html diff --git a/packaging/osx/clisdk/Distribution-Template b/packaging/osx/clisdk/Distribution-Template index 5d4390ac3..e4cb89bc4 100644 --- a/packaging/osx/clisdk/Distribution-Template +++ b/packaging/osx/clisdk/Distribution-Template @@ -5,13 +5,12 @@ + - + - - @@ -24,7 +23,7 @@ - + @@ -34,4 +33,4 @@ {HostFxrComponentId}.pkg {SharedHostComponentId}.pkg {CLISdkComponentId}.pkg - + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/cs.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/cs.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/cs.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/de.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/de.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/de.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/en.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/en.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/en.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/es.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/es.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/es.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/fr.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/fr.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/fr.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/it.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/it.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/it.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/ja.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/ja.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/ja.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/ko.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/ko.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/ko.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/pl.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/pl.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/pl.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/pt-br.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/pt-br.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/pt-br.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/ru.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/ru.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/ru.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/tr.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/tr.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/tr.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/zh-hans.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/zh-hans.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/zh-hans.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file diff --git a/packaging/osx/clisdk/resources/zh-hant.lproj/firstTimeWelcomeMessage.html b/packaging/osx/clisdk/resources/zh-hant.lproj/firstTimeWelcomeMessage.html new file mode 100644 index 000000000..af9179267 --- /dev/null +++ b/packaging/osx/clisdk/resources/zh-hant.lproj/firstTimeWelcomeMessage.html @@ -0,0 +1,29 @@ + + + + + Welcome to .NET Core! + + + +

+ Welcome to .NET Core! +

+

+ Learn more about .NET Core at https://aka.ms/dotnet-docs . Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. +

+

+ Telemetry +

+

+ The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry. +

+

+ Configuration +

+

+ A command is run in the end of install process to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once. +

+
+ + \ No newline at end of file From b6d9520ffc1ffc600a072404b69caf929c37bcbd Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 27 Apr 2017 15:48:48 -0700 Subject: [PATCH 21/68] Fix tests that require .NET Core 1.1 --- .../GivenAppThrowingException.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs index 0ce3550cb..1470e6d78 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAppThrowingException.cs @@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests { public class GivenAppThrowingException : TestBase { - [Fact] + [RequiresSpecificFrameworkFact("netcoreapp1.1")] public void ItShowsStackTraceWhenRun() { var root = TestAssets.Get("NonRestoredTestProjects", "AppThrowingException") @@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests .And.HaveStdErrContaining(msg2); } - [Fact] + [RequiresSpecificFrameworkFact("netcoreapp1.1")] public void ItShowsStackTraceWhenRunAsTool() { var root = TestAssets.Get("NonRestoredTestProjects", "AppThrowingException") From 6a03ff2255f8752c40085a44984d6cff627e0496 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Fri, 28 Apr 2017 00:46:59 +0000 Subject: [PATCH 22/68] Update CoreSetup to preview1-002101 --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 99e55e6d9..c3798e1af 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.0.0-preview1-002091-00 + 2.0.0-preview1-002101-00 15.2.0-preview-000093-02 2.0.0-rc4-61325-08 2.0.0-alpha-20170427-1 @@ -14,8 +14,8 @@ 1.0.0-beta2-20170425-201 1.0.0-beta2-20170425-203 1.0.0-beta2-20170425-203 - 2.0.0-preview1-002091 - 2.0.0-preview1-002091 + 2.0.0-preview1-002101 + 2.0.0-preview1-002101 0.1.0-alpha-142 From 5a81be48d02ad9147c91326090df39bd43163609 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 27 Apr 2017 20:13:46 -0500 Subject: [PATCH 23/68] Update NET.Sdk to 20170428-1 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 99e55e6d9..10852aa5c 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.0.0-preview1-002091-00 15.2.0-preview-000093-02 2.0.0-rc4-61325-08 - 2.0.0-alpha-20170427-1 + 2.0.0-alpha-20170428-1 4.3.0-beta1-2418 1.0.0-rel-20170413-451 15.1.0-preview-20170414-04 From effe64f0dd284730dd988f91cd2a4bb811fd495e Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Thu, 27 Apr 2017 22:31:37 -0700 Subject: [PATCH 24/68] Update ASP.NET packages to version 24686 --- NuGet.Config | 2 +- build/DependencyVersions.props | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index e7b530794..4d79bc8e0 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -5,7 +5,7 @@ - + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 64284b4d5..9089c01f2 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -11,9 +11,9 @@ $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) - 1.0.0-beta2-20170425-201 - 1.0.0-beta2-20170425-203 - 1.0.0-beta2-20170425-203 + 1.0.0-beta2-20170427-205 + 1.0.0-beta2-20170427-205 + 1.0.0-beta2-20170427-205 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 From 27b77da7a1865880622f8b0d4f5ab50d128ae257 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Thu, 27 Apr 2017 14:46:40 -0700 Subject: [PATCH 25/68] ASP .NET Core Runtime in the CLI; work in progress --- build/BundledRuntimes.props | 15 +++++++++++++++ build/DependencyVersions.props | 2 ++ 2 files changed, 17 insertions(+) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 6d3430d39..707d709f2 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -13,6 +13,12 @@ dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerPortableSuffix)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedFrameworkInstallerFileName) + + Build.RuntimeStore.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip + AspNetCorePackageStoreLib$(Architecture).wixlib + + $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerFileName) + $(ProductMonikerRid) @@ -28,6 +34,7 @@ $(CoreSetupBlobRootUrlWithChannel)/Installers $(IntermediateDirectory)/coreSetupDownload/$(SharedFrameworkVersion) $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive + $(CoreSetupBlobRootUrl)aspnetcore/store @@ -58,5 +65,13 @@ $(DownloadedHostFxrInstallerFile) + + <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerFile" + Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(ASPNETCoreRuntimeInstallerFile)') And '$(InstallerExtension)' != ''"> + $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerFileName) + $(ASPNETCoreRuntimeInstallerFile) + $(IntermediateDirectory)/ASPNETCoreRuntimeStore + + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 64284b4d5..ec4d8c342 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,6 +17,8 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 + 2.0.11626.0-TEST + preview1-24648 From b43acf4752a7841ee8b8e6be76dd51ec67f79761 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Thu, 27 Apr 2017 16:09:51 -0700 Subject: [PATCH 26/68] Updated ASP .NET Core Runtime blob storage configuration. --- build/BundledRuntimes.props | 18 +++++++++++------- build/DependencyVersions.props | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 707d709f2..7c7df1543 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -13,12 +13,6 @@ dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerPortableSuffix)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedFrameworkInstallerFileName) - - Build.RuntimeStore.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip - AspNetCorePackageStoreLib$(Architecture).wixlib - - $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerFileName) - $(ProductMonikerRid) @@ -34,7 +28,17 @@ $(CoreSetupBlobRootUrlWithChannel)/Installers $(IntermediateDirectory)/coreSetupDownload/$(SharedFrameworkVersion) $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive + + + $(CoreSetupBlobRootUrl)aspnetcore/store + $(IntermediateDirectory)/ASPNETCoreRuntimeDownload + + + Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip + AspNetCorePackageStoreLib$(Architecture).wixlib + + $(ASPNETCoreRuntimeDownloadDirectory)/$(ASPNETCoreRuntimeInstallerFileName) @@ -66,7 +70,7 @@ - <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerFile" + <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerFile" Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(ASPNETCoreRuntimeInstallerFile)') And '$(InstallerExtension)' != ''"> $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerFileName) $(ASPNETCoreRuntimeInstallerFile) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ec4d8c342..a3783839d 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,8 +17,8 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 - 2.0.11626.0-TEST - preview1-24648 + 2.0.0-preview1-30 + preview1 From 7dadb150afcfdfadff6b7526f282c891c34ee000 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 27 Apr 2017 18:04:19 -0700 Subject: [PATCH 27/68] Updating the URL for the aspnet runtime store artifacts. Fixing a typo on ExtractDestination and condition extraction on file extension rather than OS. --- build/BundledRuntimes.props | 27 +++++++++++++++++++++++++-- build/OutputDirectories.props | 1 + build/Prepare.targets | 4 ++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 7c7df1543..1f61ff3fc 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -13,6 +13,13 @@ dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerPortableSuffix)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedFrameworkInstallerFileName) + + Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip + AspNetCorePackageStoreLib$(Architecture).wixlib + + $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerArchiveFileName) + $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerWixLibFileName) + $(ProductMonikerRid) @@ -60,22 +67,38 @@ Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName) $(DownloadedSharedHostInstallerFile) - + <_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile" Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName) $(DownloadedHostFxrInstallerFile) - + +<<<<<<< HEAD <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerFile" Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(ASPNETCoreRuntimeInstallerFile)') And '$(InstallerExtension)' != ''"> $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerFileName) $(ASPNETCoreRuntimeInstallerFile) $(IntermediateDirectory)/ASPNETCoreRuntimeStore +======= + <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerWixLibFile" + Condition=" '$(ASPNETCoreRuntimeInstallerWixLibFile)' != '' And !Exists('$(ASPNETCoreRuntimeInstallerWixLibFile)')"> + $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerWixLibFileName) + $(ASPNETCoreRuntimeInstallerWixLibFile) + + + + <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerArchiveFile" + Condition="!Exists('$(ASPNETCoreRuntimeInstallerArchiveFile)')"> + $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerArchiveFileName) + $(ASPNETCoreRuntimeInstallerArchiveFile) + $(AspNetRuntimePackageStorePublishDirectory) + +>>>>>>> Updating the URL for the aspnet runtime store artifacts. Fixing a typo on ExtractDestination and condition extraction on file extension rather than OS. diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index 99a5666cf..d11542cf2 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -10,6 +10,7 @@ $(BaseOutputDirectory)/intermediate $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish + $(IntermediateDirectory)/ASPNETCoreRuntimeStore $(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) diff --git a/build/Prepare.targets b/build/Prepare.targets index d875e2b8b..074f4b758 100644 --- a/build/Prepare.targets +++ b/build/Prepare.targets @@ -36,12 +36,12 @@ Uri="%(_DownloadAndExtractItem.Url)" DestinationPath="%(_DownloadAndExtractItem.DownloadFileName)" /> - - From d26b41a0c3aa9f0217a3722bc5dca5147d6d6af8 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 26 Apr 2017 15:01:59 -0700 Subject: [PATCH 28/68] Add msbuild sdk resolver --- build/Compile.targets | 2 + build/DependencyVersions.props | 2 +- .../Microsoft.DotNet.Cli.Utils.csproj | 5 +- .../Interop.Common.cs | 36 +++++ .../Interop.NETFramework.cs | 45 +++++++ .../Interop.NETStandard.cs | 37 ++++++ .../MSBuildSdkResolver.cs | 123 ++++++++++++++++++ ...Microsoft.DotNet.MSBuildSdkResolver.csproj | 38 ++++++ .../Microsoft.DotNet.MSBuildSdkResolver.sln | 28 ++++ test/Microsoft.DotNet.Cli.Tests.sln | 14 ++ .../GivenAnMSBuildSdkResolver.cs | 70 ++++++++++ ...oft.DotNet.MSBuildSdkResolver.Tests.csproj | 29 +++++ .../xunit.runner.json | 3 + 13 files changed, 429 insertions(+), 3 deletions(-) create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/Interop.Common.cs create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETFramework.cs create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj create mode 100644 src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.sln create mode 100644 test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnMSBuildSdkResolver.cs create mode 100644 test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj create mode 100644 test/Microsoft.DotNet.MSBuildSdkResolver.Tests/xunit.runner.json diff --git a/build/Compile.targets b/build/Compile.targets index b2ebb2ebc..b44ed8380 100644 --- a/build/Compile.targets +++ b/build/Compile.targets @@ -12,5 +12,7 @@ + + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 64284b4d5..e025ef04a 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.0.0-preview1-002101-00 - 15.2.0-preview-000093-02 + 15.3.0-preview-000111-01 2.0.0-rc4-61325-08 2.0.0-alpha-20170428-1 4.3.0-beta1-2418 diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index 5d14b7b57..bc95703fb 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -20,7 +20,8 @@ - + + @@ -31,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.Common.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.Common.cs new file mode 100644 index 000000000..580d1220b --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.Common.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Diagnostics; +using System.Text; + +namespace Microsoft.DotNet.MSBuildSdkResolver +{ + internal static partial class Interop + { + internal static string hostfxr_resolve_sdk(string exe_dir, string working_dir) + { + var buffer = new StringBuilder(capacity: 64); + + for (;;) + { + int size = hostfxr_resolve_sdk(exe_dir, working_dir, buffer, buffer.Capacity); + if (size <= 0) + { + Debug.Assert(size == 0); + return null; + } + + if (size <= buffer.Capacity) + { + break; + } + + buffer.Capacity = size; + } + + return buffer.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETFramework.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETFramework.cs new file mode 100644 index 000000000..d1d567e8b --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETFramework.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if NET46 + +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.DotNet.MSBuildSdkResolver +{ + internal static partial class Interop + { + static Interop() + { + PreloadLibrary("hostfxr.dll"); + } + + // MSBuild SDK resolvers are required to be AnyCPU, but we have a native dependency and .NETFramework does not + // have a built-in facility for dynamically loading user native dlls for the appropriate platform. We therefore + // preload the version with the correct architecture (from a corresponding sub-folder relative to us) on static + // construction so that subsequent P/Invokes can find it. + private static void PreloadLibrary(string dllFileName) + { + string basePath = Path.GetDirectoryName(typeof(Interop).Assembly.Location); + string architecture = IntPtr.Size == 8 ? "x64" : "x86"; + string dllPath = Path.Combine(basePath, architecture, dllFileName); + + // return value is intentially ignored as we let the subsequent P/Invokes fail naturally. + LoadLibraryExW(dllPath, IntPtr.Zero, LOAD_WITH_ALTERED_SEARCH_PATH); + } + + // lpFileName passed to LoadLibraryEx must be a full path. + private const int LOAD_WITH_ALTERED_SEARCH_PATH = 0x8; + + [DllImport("kernel32", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] + private static extern IntPtr LoadLibraryExW(string lpFileName, IntPtr hFile, int dwFlags); + + [DllImport("hostfxr", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] + private static extern int hostfxr_resolve_sdk(string exe_dir, string working_dir, [Out] StringBuilder buffer, int buffer_size); + } +} + +#endif // NET46 \ No newline at end of file diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs new file mode 100644 index 000000000..bff6fd84b --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs @@ -0,0 +1,37 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// NOTE: Currently, only the NET46 build ships (with Visual Studio/desktop msbuild), +// but the netstandard1.3 adaptation here acts a proof-of-concept for cross-platform +// portability of the underlying hostfxr API and gives us build and test coverage +// on non-Windows machines. +#if NETSTANDARD1_3 + +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.DotNet.MSBuildSdkResolver +{ + internal static partial class Interop + { + internal static readonly bool s_runningOnWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + + private static int hostfxr_resolve_sdk(string exe_dir, string working_dir, [Out] StringBuilder buffer, int buffer_size) + { + // hostfxr string encoding is platform -specific so dispatch to the + // appropriately annotated P/Invoke for the current platform. + return s_runningOnWindows + ? windows_hostfxr_resolve_sdk(exe_dir, working_dir, buffer, buffer_size) + : unix_hostfxr_resolve_sdk(exe_dir, working_dir, buffer, buffer_size); + } + + [DllImport("hostfxr", EntryPoint = nameof(hostfxr_resolve_sdk), CharSet = CharSet.Unicode, ExactSpelling=true, CallingConvention = CallingConvention.Cdecl)] + private static extern int windows_hostfxr_resolve_sdk(string exe_dir, string working_dir, [Out] StringBuilder buffer, int buffer_size); + + // CharSet.Ansi is UTF8 on Unix + [DllImport("hostfxr", EntryPoint = nameof(hostfxr_resolve_sdk), CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] + private static extern int unix_hostfxr_resolve_sdk(string exe_dir, string working_dir, [Out] StringBuilder buffer, int buffer_size); + } +} + +#endif // NETSTANDARD1_3 \ No newline at end of file diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs new file mode 100644 index 000000000..fefbd46d0 --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs @@ -0,0 +1,123 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.Build.Framework; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.DotNet.MSBuildSdkResolver +{ + public sealed class DotNetMSBuildSdkResolver : SdkResolver + { + public override string Name => "Microsoft.DotNet.MSBuildSdkResolver"; + + // Default resolver has priority 10000 and we want to go before it and leave room on either side of us. + public override int Priority => 5000; + + public override SdkResult Resolve(SdkReference sdkReference, SdkResolverContext context, SdkResultFactory factory) + { + // These are overrides that are used to force the resolved SDK tasks and targets to come from a given + // base directory and report a given version to msbuild (which may be null if unknown. One key use case + // for this is to test SDK tasks and targets without deploying them inside the .NET Core SDK. + string msbuildSdksDir = Environment.GetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR"); + string netcoreSdkVersion = Environment.GetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER"); + + if (msbuildSdksDir == null) + { + string netcoreSdkDir = ResolveNetcoreSdkDirectory(context); + if (netcoreSdkDir == null) + { + return factory.IndicateFailure( + new[] + { + "Unable to locate the .NET Core SDK. Check that it is installed and that the version" + + "specified in global.json (if any) matches the installed version." + }); + } + + msbuildSdksDir = Path.Combine(netcoreSdkDir, "Sdks"); + netcoreSdkVersion = new DirectoryInfo(netcoreSdkDir).Name;; + } + + string msbuildSdkDir = Path.Combine(msbuildSdksDir, sdkReference.Name, "Sdk"); + if (!Directory.Exists(msbuildSdkDir)) + { + return factory.IndicateFailure( + new[] + { + $"{msbuildSdkDir} not found. Check that a recent enough .NET Core SDK is installed" + + " and/or increase the version specified in global.json. " + }); + } + + return factory.IndicateSuccess(msbuildSdkDir, netcoreSdkVersion); + } + + private string ResolveNetcoreSdkDirectory(SdkResolverContext context) + { + foreach (string exeDir in GetDotnetExeDirectoryCandidates()) + { + string workingDir = context.SolutionFilePath ?? context.ProjectFilePath; + string netcoreSdkDir = Interop.hostfxr_resolve_sdk(exeDir, workingDir); + + if (netcoreSdkDir != null) + { + return netcoreSdkDir; + } + } + + return null; + } + + // Search for [ProgramFiles]\dotnet in this order. Only ProgramFiles is defined on + private static readonly string[] s_programFiles = new[] + { + // "c:\Program Files" on x64 machine regardless process bitness, undefined on x86 machines. + "ProgramW6432", + + // "c:\Program Files (x86)" on x64 machine regardless of process bitness, undefined on x64 machines. + "ProgramFiles(x86)", + + // "c:\Program Files" in x64 process, "c:\Program Files (x86)" in x86 process. + // hostfxr will search this on its own if multilevel lookup is not disable, but + // we do it explicitly to prevent an environment with disabled multilevel lookup + // from crippling desktop msbuild and VS. + "ProgramFiles", + }; + + private List GetDotnetExeDirectoryCandidates() + { + string environmentOverride = Environment.GetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR"); + if (environmentOverride != null) + { + return new List(1) { environmentOverride }; + } + + // Initial capacity is 2 because while there are 3 candidates, we expect at most 2 unique ones (x64 + x86) + // Also, N=3 here means that we needn't be concerned with the O(N^2) complexity of the foreach + contains. + var candidates = new List(2); + foreach (string variable in s_programFiles) + { + string directory = Environment.GetEnvironmentVariable(variable); + if (directory == null) + { + continue; + } + + directory = Path.Combine(directory, "dotnet"); + if (!candidates.Contains(directory)) + { + candidates.Add(directory); + } + } + + if (candidates.Count == 0) + { + candidates.Add(null); + } + + return candidates; + } + } +} diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj new file mode 100644 index 000000000..b6399659d --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj @@ -0,0 +1,38 @@ + + + + + $(SdkVersion) + netstandard1.3;net46 + netstandard1.3 + AnyCPU + win-x86;win-x64 + true + ../../tools/Key.snk + true + true + false + + + + + + + + + + + + + + + x86/hostfxr.dll + PreserveNewest + + + x64/hostfxr.dll + PreserveNewest + + + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.sln b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.sln new file mode 100644 index 000000000..4d5062122 --- /dev/null +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26425.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MSBuildSdkResolver", "Microsoft.DotNet.MSBuildSdkResolver.csproj", "{DCB2A518-7BC6-43F5-BE2C-13B11A1F3961}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MSBuildSdkResolver.Tests", "..\..\test\Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj", "{CC488F39-E106-4BF4-9599-19A265AFD9AC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCB2A518-7BC6-43F5-BE2C-13B11A1F3961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCB2A518-7BC6-43F5-BE2C-13B11A1F3961}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCB2A518-7BC6-43F5-BE2C-13B11A1F3961}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCB2A518-7BC6-43F5-BE2C-13B11A1F3961}.Release|Any CPU.Build.0 = Release|Any CPU + {CC488F39-E106-4BF4-9599-19A265AFD9AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC488F39-E106-4BF4-9599-19A265AFD9AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC488F39-E106-4BF4-9599-19A265AFD9AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC488F39-E106-4BF4-9599-19A265AFD9AC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index 30e4e2f60..ffc08cbd5 100644 --- a/test/Microsoft.DotNet.Cli.Tests.sln +++ b/test/Microsoft.DotNet.Cli.Tests.sln @@ -76,6 +76,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-store.Tests", "dotne EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-back-compat.Tests", "dotnet-back-compat.Tests\dotnet-back-compat.Tests.csproj", "{27351B2F-325B-4843-9F4C-BC53FD06A7B5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MSBuildSdkResolver.Tests", "Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj", "{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -506,6 +508,18 @@ Global {27351B2F-325B-4843-9F4C-BC53FD06A7B5}.Release|x64.Build.0 = Release|Any CPU {27351B2F-325B-4843-9F4C-BC53FD06A7B5}.Release|x86.ActiveCfg = Release|Any CPU {27351B2F-325B-4843-9F4C-BC53FD06A7B5}.Release|x86.Build.0 = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|x64.ActiveCfg = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|x64.Build.0 = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|x86.ActiveCfg = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|x86.Build.0 = Debug|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|Any CPU.Build.0 = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|x64.ActiveCfg = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|x64.Build.0 = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|x86.ActiveCfg = Release|Any CPU + {42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnMSBuildSdkResolver.cs b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnMSBuildSdkResolver.cs new file mode 100644 index 000000000..bfbf14e4a --- /dev/null +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnMSBuildSdkResolver.cs @@ -0,0 +1,70 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using Microsoft.Build.Framework; +using Xunit; +using System.Linq; +using Xunit.Abstractions; +using System; +using Microsoft.DotNet.MSBuildSdkResolver; + +namespace Microsoft.DotNet.Cli.Utils.Tests +{ + public class GivenAnMSBuildSdkResolver + { + private ITestOutputHelper _logger; + + public GivenAnMSBuildSdkResolver(ITestOutputHelper logger) + { + _logger = logger; + } + + [Fact] + public void ItHasCorrectNameAndPriority() + { + var resolver = new DotNetMSBuildSdkResolver(); + + Assert.Equal(5000, resolver.Priority); + Assert.Equal("Microsoft.DotNet.MSBuildSdkResolver", resolver.Name); + } + + [Fact] + public void ItCallsNativeCodeWithoutCrashing() // WIP: placeholder to get plumbing through + { + var resolver = new DotNetMSBuildSdkResolver(); + var result = (MockResult)resolver.Resolve( + new SdkReference("Microsoft.NET.Sdk", null, null), + new MockContext(), + new MockFactory()); + + _logger.WriteLine($"success: {result.Success}"); + _logger.WriteLine($"errors: {string.Join(Environment.NewLine, result.Errors ?? Array.Empty())}"); + _logger.WriteLine($"warnings: {string.Join(Environment.NewLine, result.Warnings ?? Array.Empty())}"); + _logger.WriteLine($"path: {result.Path}"); + _logger.WriteLine($"version: {result.Version}"); + } + + private sealed class MockContext : SdkResolverContext + { + } + + private sealed class MockFactory : SdkResultFactory + { + public override SdkResult IndicateFailure(IEnumerable errors, IEnumerable warnings = null) + => new MockResult { Success = false, Errors = errors, Warnings = warnings }; + + public override SdkResult IndicateSuccess(string path, string version, IEnumerable warnings = null) + => new MockResult { Success = true, Path = path, Version = version, Warnings = warnings }; + } + + private sealed class MockResult : SdkResult + { + public new bool Success { get => base.Success; set => base.Success = value; } + public string Version { get; set; } + public string Path { get; set; } + public IEnumerable Errors { get; set; } + public IEnumerable Warnings { get; set; } + } + } +} diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj new file mode 100644 index 000000000..e302505e4 --- /dev/null +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj @@ -0,0 +1,29 @@ + + + + + net46;$(CliTargetFramework) + $(CliTargetFramework) + $(CLI_SharedFrameworkVersion) + Exe + ../../tools/Key.snk + true + true + + + + + + + + + + + + + + + + + + diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/xunit.runner.json b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/xunit.runner.json new file mode 100644 index 000000000..34b2fe2cd --- /dev/null +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/xunit.runner.json @@ -0,0 +1,3 @@ +{ + "shadowCopy": false +} \ No newline at end of file From afd1d8ed66a15a43ec9ef36fadba172df9ab646e Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 26 Apr 2017 23:28:57 -0700 Subject: [PATCH 29/68] Reduce build console output spew --- run-build.ps1 | 2 +- run-build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 0c3ed5443..e97c49c1e 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -124,6 +124,6 @@ if ($NoBuild) else { dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles - dotnet msbuild build.proj /m /v:diag /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters + dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters if($LASTEXITCODE -ne 0) { throw "Failed to build" } } diff --git a/run-build.sh b/run-build.sh index 16cece2d1..77034b6a6 100755 --- a/run-build.sh +++ b/run-build.sh @@ -203,7 +203,7 @@ echo "${args[@]}" if [ $BUILD -eq 1 ]; then dotnet msbuild build.proj /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles - dotnet msbuild build.proj /m /v:diag /fl /flp:v=diag /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS "${args[@]}" + dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS "${args[@]}" else echo "Not building due to --nobuild" echo "Command that would be run is: 'dotnet msbuild build.proj /m /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS ${args[@]}'" From 77ab1c58574bae03a68347d73e33fe799091afaa Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 27 Apr 2017 22:28:32 -0700 Subject: [PATCH 30/68] Add option to skip LZMA build --- src/redist/redist.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index b8bd12306..bc00e7e3f 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -148,6 +148,7 @@ From fa4fe3b2c6e006d570551741df2a2b01da73e87d Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 27 Apr 2017 23:05:48 -0700 Subject: [PATCH 31/68] Package MSBuild SDK resolver in VS insertion nupkg --- build/Compile.targets | 7 +++++++ build/MSBuildExtensions.targets | 8 ++------ build/OutputDirectories.props | 1 + build/package/Installer.MSI.targets | 4 ++-- .../Microsoft.DotNet.MSBuildSdkResolver.csproj | 7 ++++--- .../Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj | 1 + 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/build/Compile.targets b/build/Compile.targets index b44ed8380..d2a3747aa 100644 --- a/build/Compile.targets +++ b/build/Compile.targets @@ -13,6 +13,13 @@ + + + + diff --git a/build/MSBuildExtensions.targets b/build/MSBuildExtensions.targets index 9b99b96b9..b8d2d97e9 100644 --- a/build/MSBuildExtensions.targets +++ b/build/MSBuildExtensions.targets @@ -9,7 +9,6 @@ - 15.0/Imports/Microsoft.Common.props/ImportBefore Microsoft.NETCoreSdk.BundledVersions.props @@ -59,12 +58,9 @@ Copyright (c) .NET Foundation. All rights reserved. - - + - diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index 99a5666cf..8d3df1307 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -14,5 +14,6 @@ $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) $(IntermediateDirectory)/GeneratedMSBuildExtensions + $(IntermediateDirectory)/MSBuildSdkResolver diff --git a/build/package/Installer.MSI.targets b/build/package/Installer.MSI.targets index 86e81c22b..c132efdb0 100644 --- a/build/package/Installer.MSI.targets +++ b/build/package/Installer.MSI.targets @@ -146,13 +146,13 @@ diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj index b6399659d..335eed3ce 100644 --- a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj @@ -12,11 +12,12 @@ true true false + $(SdkResolverOutputDirectory) - - + + @@ -35,4 +36,4 @@ - \ No newline at end of file + diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj index e302505e4..bfc8f571a 100644 --- a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj @@ -16,6 +16,7 @@ + From 50c7b1e9b6a250578ba7e782aabefb78bb88b252 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 27 Apr 2017 22:20:43 -0700 Subject: [PATCH 32/68] Copying the aspnet runtime store artifacts to stage2. --- build/BackwardsCompatibilityRuntimes.props | 2 +- build/BundledRuntimes.props | 30 +++++----------------- run-build.ps1 | 2 +- run-build.sh | 2 +- src/redist/redist.csproj | 11 ++++++++ 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/build/BackwardsCompatibilityRuntimes.props b/build/BackwardsCompatibilityRuntimes.props index 5cadcb052..6805d4377 100644 --- a/build/BackwardsCompatibilityRuntimes.props +++ b/build/BackwardsCompatibilityRuntimes.props @@ -20,7 +20,7 @@ $(BackwardsCompatibility110CoreSetupBlobRootUrlWithChannel)/Binaries/$(BackwardsCompatibility110SharedFrameworkVersion) $(BackwardsCompatibility110CoreSetupBlobRootUrlWithChannel)/Installers $(IntermediateDirectory)/coreSetupDownload/$(BackwardsCompatibility110SharedFrameworkVersion) - $(BackwardsCompatibility110CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive + $(BackwardsCompatibility110CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive$(ArchiveExtension) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 1f61ff3fc..c0d959c9f 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -13,13 +13,6 @@ dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerPortableSuffix)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedFrameworkInstallerFileName) - - Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip - AspNetCorePackageStoreLib$(Architecture).wixlib - - $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerArchiveFileName) - $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerWixLibFileName) - $(ProductMonikerRid) @@ -34,18 +27,18 @@ $(CoreSetupBlobRootUrlWithChannel)/Binaries/$(SharedFrameworkVersion) $(CoreSetupBlobRootUrlWithChannel)/Installers $(IntermediateDirectory)/coreSetupDownload/$(SharedFrameworkVersion) - $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive + $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive$(ArchiveExtension) $(CoreSetupBlobRootUrl)aspnetcore/store - $(IntermediateDirectory)/ASPNETCoreRuntimeDownload - Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip - AspNetCorePackageStoreLib$(Architecture).wixlib + Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip + AspNetCorePackageStoreLib$(Architecture).wixlib - $(ASPNETCoreRuntimeDownloadDirectory)/$(ASPNETCoreRuntimeInstallerFileName) + $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerArchiveFileName) + $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerWixLibFileName) @@ -67,24 +60,16 @@ Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName) $(DownloadedSharedHostInstallerFile) - + <_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile" Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName) $(DownloadedHostFxrInstallerFile) - + -<<<<<<< HEAD - <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerFile" - Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(ASPNETCoreRuntimeInstallerFile)') And '$(InstallerExtension)' != ''"> - $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerFileName) - $(ASPNETCoreRuntimeInstallerFile) - $(IntermediateDirectory)/ASPNETCoreRuntimeStore - -======= <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerWixLibFile" Condition=" '$(ASPNETCoreRuntimeInstallerWixLibFile)' != '' And !Exists('$(ASPNETCoreRuntimeInstallerWixLibFile)')"> $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerWixLibFileName) @@ -98,7 +83,6 @@ $(ASPNETCoreRuntimeInstallerArchiveFile) $(AspNetRuntimePackageStorePublishDirectory) ->>>>>>> Updating the URL for the aspnet runtime store artifacts. Fixing a typo on ExtractDestination and condition extraction on file extension rather than OS. diff --git a/run-build.ps1 b/run-build.ps1 index 0c3ed5443..e97c49c1e 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -124,6 +124,6 @@ if ($NoBuild) else { dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles - dotnet msbuild build.proj /m /v:diag /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters + dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters if($LASTEXITCODE -ne 0) { throw "Failed to build" } } diff --git a/run-build.sh b/run-build.sh index 16cece2d1..77034b6a6 100755 --- a/run-build.sh +++ b/run-build.sh @@ -203,7 +203,7 @@ echo "${args[@]}" if [ $BUILD -eq 1 ]; then dotnet msbuild build.proj /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles - dotnet msbuild build.proj /m /v:diag /fl /flp:v=diag /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS "${args[@]}" + dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS "${args[@]}" else echo "Not building due to --nobuild" echo "Command that would be run is: 'dotnet msbuild build.proj /m /p:Architecture=$ARCHITECTURE $CUSTOM_BUILD_ARGS ${args[@]}'" diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index b8bd12306..540a64ac4 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -30,6 +30,17 @@ + + + + + + + + + From 1df11c39181e358269310e193c7d7ddb929b93b0 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Fri, 28 Apr 2017 09:57:29 -0700 Subject: [PATCH 33/68] Moving to new version for ASP .Net Core Runtime; accounting for the split of the Windows ZIP ASP .Net Core Runtime for x64/x86; trivial formating --- build/BundledRuntimes.props | 33 +++++++++++++++++---------------- build/DependencyVersions.props | 6 +++--- build/OutputDirectories.props | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index c0d959c9f..3c91819a7 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -31,14 +31,15 @@ - $(CoreSetupBlobRootUrl)aspnetcore/store + $(CoreSetupBlobRootUrl)aspnetcore/store - - Build.RS.$(OSName)-$(ASPNETCoreRuntimeFileNameVersionToken).zip - AspNetCorePackageStoreLib$(Architecture).wixlib + + Build.RS.$(OSName)-$(AspNetCoreRuntimeFileNameVersionToken).zip + Build.RS.$(OSName)$(Architecture)-$(AspNetCoreRuntimeFileNameVersionToken).zip + AspNetCorePackageStoreLib$(Architecture).wixlib - $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerArchiveFileName) - $(PackagesDirectory)/$(ASPNETCoreRuntimeInstallerWixLibFileName) + $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerArchiveFileName) + $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerWixLibFileName) @@ -60,27 +61,27 @@ Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName) $(DownloadedSharedHostInstallerFile) - + <_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile" Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName) $(DownloadedHostFxrInstallerFile) - + - <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerWixLibFile" - Condition=" '$(ASPNETCoreRuntimeInstallerWixLibFile)' != '' And !Exists('$(ASPNETCoreRuntimeInstallerWixLibFile)')"> - $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerWixLibFileName) - $(ASPNETCoreRuntimeInstallerWixLibFile) + <_DownloadAndExtractItem Include="AspNetCoreRuntimeInstallerWixLibFile" + Condition=" '$(AspNetCoreRuntimeInstallerWixLibFile)' != '' And !Exists('$(AspNetCoreRuntimeInstallerWixLibFile)')"> + $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeVersion)/$(AspNetCoreRuntimeInstallerWixLibFileName) + $(AspNetCoreRuntimeInstallerWixLibFile) - <_DownloadAndExtractItem Include="ASPNETCoreRuntimeInstallerArchiveFile" - Condition="!Exists('$(ASPNETCoreRuntimeInstallerArchiveFile)')"> - $(ASPNETCoreRuntimeInstallerBlobRootUrl)/$(ASPNETCoreRuntimeVersion)/$(ASPNETCoreRuntimeInstallerArchiveFileName) - $(ASPNETCoreRuntimeInstallerArchiveFile) + <_DownloadAndExtractItem Include="AspNetCoreRuntimeInstallerArchiveFile" + Condition="!Exists('$(AspNetCoreRuntimeInstallerArchiveFile)')"> + $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeVersion)/$(AspNetCoreRuntimeInstallerArchiveFileName) + $(AspNetCoreRuntimeInstallerArchiveFile) $(AspNetRuntimePackageStorePublishDirectory) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index a3783839d..55dc0fbba 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,10 +17,10 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 - 2.0.0-preview1-30 - preview1 + 2.0.0-preview1-34 + preview1 - + diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index d11542cf2..3376d5475 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -10,7 +10,7 @@ $(BaseOutputDirectory)/intermediate $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish - $(IntermediateDirectory)/ASPNETCoreRuntimeStore + $(IntermediateDirectory)/AspNetCoreRuntimeStore $(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) From 68487f775b3c06fe078283bb66a99cf6aa817b7b Mon Sep 17 00:00:00 2001 From: John Beisner Date: Fri, 28 Apr 2017 10:21:35 -0700 Subject: [PATCH 34/68] Change in ASP .Net Core Runtime blob storage ZIP file naming convention. --- build/BundledRuntimes.props | 4 ++-- build/DependencyVersions.props | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 3c91819a7..66b794887 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -34,8 +34,8 @@ $(CoreSetupBlobRootUrl)aspnetcore/store - Build.RS.$(OSName)-$(AspNetCoreRuntimeFileNameVersionToken).zip - Build.RS.$(OSName)$(Architecture)-$(AspNetCoreRuntimeFileNameVersionToken).zip + Build.RS.$(OSName).zip + Build.RS.$(OSName)$(Architecture).zip AspNetCorePackageStoreLib$(Architecture).wixlib $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerArchiveFileName) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 55dc0fbba..f19b6c672 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -18,8 +18,6 @@ 2.0.0-preview1-002101 0.1.0-alpha-142 2.0.0-preview1-34 - preview1 - From 09dd14bfe467e1cd264740af6ed4a8a243ccb53a Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Fri, 28 Apr 2017 10:37:20 -0700 Subject: [PATCH 35/68] Fix some comments and add missing space to error message --- .../MSBuildSdkResolver.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs index fefbd46d0..6048d3d59 100644 --- a/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.MSBuildSdkResolver new[] { "Unable to locate the .NET Core SDK. Check that it is installed and that the version" - + "specified in global.json (if any) matches the installed version." + + " specified in global.json (if any) matches the installed version." }); } @@ -70,19 +70,22 @@ namespace Microsoft.DotNet.MSBuildSdkResolver return null; } - // Search for [ProgramFiles]\dotnet in this order. Only ProgramFiles is defined on + // Search for [ProgramFiles]\dotnet in this order. private static readonly string[] s_programFiles = new[] { - // "c:\Program Files" on x64 machine regardless process bitness, undefined on x86 machines. + // "c:\Program Files" on x64 machine regardless process architecture. + // Undefined on x86 machines. "ProgramW6432", - // "c:\Program Files (x86)" on x64 machine regardless of process bitness, undefined on x64 machines. + // "c:\Program Files (x86)" on x64 machine regardless of process architecture + // Undefined on x86 machines. "ProgramFiles(x86)", - // "c:\Program Files" in x64 process, "c:\Program Files (x86)" in x86 process. - // hostfxr will search this on its own if multilevel lookup is not disable, but - // we do it explicitly to prevent an environment with disabled multilevel lookup - // from crippling desktop msbuild and VS. + // "c:\Program Files" or "C:\Program Files (x86)" on x64 machine depending on process architecture. + // "c:\Program Files" on x86 machines (therefore not redundant with the two locations above in that case). + // + // NOTE: hostfxr will search this on its own if multilevel lookup is not disable, but we do it explicitly + // to prevent an environment with disabled multilevel lookup from crippling desktop msbuild and VS. "ProgramFiles", }; @@ -91,12 +94,12 @@ namespace Microsoft.DotNet.MSBuildSdkResolver string environmentOverride = Environment.GetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR"); if (environmentOverride != null) { - return new List(1) { environmentOverride }; + return new List(capacity: 1) { environmentOverride }; } // Initial capacity is 2 because while there are 3 candidates, we expect at most 2 unique ones (x64 + x86) // Also, N=3 here means that we needn't be concerned with the O(N^2) complexity of the foreach + contains. - var candidates = new List(2); + var candidates = new List(capacity: 2); foreach (string variable in s_programFiles) { string directory = Environment.GetEnvironmentVariable(variable); From 7477334c48cba2c9fdaebf04f32e1a4755368035 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 28 Apr 2017 10:57:19 -0700 Subject: [PATCH 36/68] Pinning stage0 to a version that rolls tools forward from 1.0 to 2.0 because the deb-tool targets netcoreapp1.0. --- run-build.ps1 | 4 ++-- run-build.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 0c3ed5443..fcc2fbdf8 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -104,8 +104,8 @@ if ($LastExitCode -ne 0) # install the post-PJnistic stage0 $dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1" -Write-Host "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Write-Host "$dotnetInstallPath -Channel ""release/2.0.0"" -Version ""2.0.0-preview1-005867"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -Version ""2.0.0-preview1-005867"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" diff --git a/run-build.sh b/run-build.sh index 16cece2d1..bf9f9dc7d 100755 --- a/run-build.sh +++ b/run-build.sh @@ -177,8 +177,8 @@ if [ $EXIT_CODE != 0 ]; then fi # now execute the script -echo "installing CLI: $dotnetInstallPath --channel \"release/2.0.0\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\" $LINUX_PORTABLE_INSTALL_ARGS" -$dotnetInstallPath --channel "release/2.0.0" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS +echo "installing CLI: $dotnetInstallPath --channel \"release/2.0.0\" --version \"2.0.0-preview1-005867\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\" $LINUX_PORTABLE_INSTALL_ARGS" +$dotnetInstallPath --channel "release/2.0.0" --version "2.0.0-preview1-005867" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS EXIT_CODE=$? if [ $EXIT_CODE != 0 ]; then echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $EXIT_CODE." >&2 From de46bf31d8c95f01acc76d7ea672b31777d50f8f Mon Sep 17 00:00:00 2001 From: John Beisner Date: Fri, 28 Apr 2017 12:25:46 -0700 Subject: [PATCH 37/68] Add ASP .Net Core Runtime to the CombinedFrameworkSdk archive. --- build/package/Layout.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/package/Layout.targets b/build/package/Layout.targets index cdbb5b13d..e989a1849 100644 --- a/build/package/Layout.targets +++ b/build/package/Layout.targets @@ -14,6 +14,8 @@ + + Date: Fri, 28 Apr 2017 14:23:25 -0700 Subject: [PATCH 38/68] Fixing the 'linux' ASP .Net Core Runtime archive download; and revving the version. --- build/BundledRuntimes.props | 11 +++++++---- build/DependencyVersions.props | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 66b794887..19897dca1 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -33,12 +33,15 @@ $(CoreSetupBlobRootUrl)aspnetcore/store - - Build.RS.$(OSName).zip - Build.RS.$(OSName)$(Architecture).zip - AspNetCorePackageStoreLib$(Architecture).wixlib + + $(OSName)$(Architecture) + $(OSName) + linux + Build.RS.$(AspNetCoreRuntimeInstallerArchiveFileNameOSToken).zip $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerArchiveFileName) + + AspNetCorePackageStoreLib$(Architecture).wixlib $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerWixLibFileName) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f19b6c672..d7025d1ce 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,7 +17,7 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 - 2.0.0-preview1-34 + 2.0.0-preview1-36 From cc9819ed93ff928085437c0c999cee45f6103e07 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 28 Apr 2017 15:45:29 -0700 Subject: [PATCH 39/68] Removing the code to generate the lzma archive and instead download it from the asp.net location. --- build/BundledRuntimes.props | 4 + build/DependencyVersions.props | 1 + build/compile/LzmaArchive.targets | 115 +---------------------- src/dotnet-archive/Program.cs | 96 ------------------- src/dotnet-archive/dotnet-archive.csproj | 20 ---- tools/Archiver/Archiver.csproj | 22 ----- 6 files changed, 9 insertions(+), 249 deletions(-) delete mode 100644 src/dotnet-archive/Program.cs delete mode 100644 src/dotnet-archive/dotnet-archive.csproj delete mode 100644 tools/Archiver/Archiver.csproj diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 6d3430d39..5388bba29 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -30,6 +30,10 @@ $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive + + $(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion) + + <_DownloadAndExtractItem Include="CombinedSharedHostAndFrameworkArchive" Condition="!Exists('$(CombinedSharedHostAndFrameworkArchive)')"> diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 64284b4d5..38c6ffb4c 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,6 +17,7 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 + 2.0.0-preview1-34 diff --git a/build/compile/LzmaArchive.targets b/build/compile/LzmaArchive.targets index ae7bf4646..8acf75bfc 100644 --- a/build/compile/LzmaArchive.targets +++ b/build/compile/LzmaArchive.targets @@ -2,127 +2,20 @@ - false - - <configuration> - <packageSources> - <add key="configurable.source" value="%CLI_LZMA_PACKAGE_SOURCE%" /> - </packageSources> - </configuration> - - - $(IntermediateDirectory)/NuGetPackagesArchiveProject - $(IntermediateDirectory)/NuGetPackagesArchiveFolder - $(NuGetPackagesArchiveProject)/Nuget.config - $(RepoRoot)/NuGet.Config - $(BaseOutputDirectory)/tools - $(ToolsOutputDirectory)/Archiver.dll $(SdkOutputDirectory)/nuGetPackagesArchive.lzma + nuGetPackagesArchive.notimestamp.lzma + $(IntermediateDirectory)/$(NugetPackagesArchiveName) + $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(NugetPackagesArchiveName) - - - - - - - - - - - $(NugetPackagesArchiveRelativeBlobUrl)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/')) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nuGetPackagesArchive.$(NuGetPackagesArchiveVersion).lzma - $(IntermediateDirectory)/$(NugetPackagesArchiveName) - $(Product)/NuGetPackagesArchives - $(DotnetBlobRootUrl)/$(NugetPackagesArchiveRelativeBlobUrl)/$(NugetPackagesArchiveName) - + diff --git a/src/dotnet-archive/Program.cs b/src/dotnet-archive/Program.cs deleted file mode 100644 index 3376bf47e..000000000 --- a/src/dotnet-archive/Program.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using Microsoft.DotNet.Cli.CommandLine; -//using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Archive; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; - -namespace Microsoft.DotNet.Tools.Archive -{ - - public partial class ArchiveCommand - { - public static int Main(string[] args) - { - //DebugHelper.HandleDebugSwitch(ref args); - - var app = new CommandLineApplication(); - app.Name = "archive"; - app.FullName = ".NET archiver"; - app.Description = "Archives and expands sets of files"; - app.HelpOption("-h|--help"); - - var extract = app.Option("-x|--extract ", "Directory to extract to", CommandOptionType.SingleValue); - var archiveFile = app.Option("-a|--archive ", "Archive to operate on", CommandOptionType.SingleValue); - var externals = app.Option("--external ...", "External files and directories to consider for extraction", CommandOptionType.MultipleValue); - var sources = app.Argument("...", "Files & directory to include in the archive", multipleValues:true); - - app.OnExecute(() => { - - if (extract.HasValue() && sources.Values.Any()) - { - Console.WriteLine("Extract '-x' can only be specified when no '' are specified to add to the archive."); - return 1; - } - else if (!extract.HasValue() && !sources.Values.Any()) - { - Console.WriteLine("Either extract '-x' or '' must be specified."); - return 1; - } - - if (!archiveFile.HasValue()) - { - Console.WriteLine("Archive '-a' must be specified."); - return 1; - } - - var progress = new ConsoleProgressReport(); - - var archive = new IndexedArchive(); - foreach (var external in externals.Values) - { - if (Directory.Exists(external)) - { - archive.AddExternalDirectory(external); - } - else - { - archive.AddExternalFile(external); - } - } - - if (sources.Values.Any()) - { - foreach(var source in sources.Values) - { - if (Directory.Exists(source)) - { - archive.AddDirectory(source, progress); - } - else - { - archive.AddFile(source, Path.GetFileName(source)); - } - } - - archive.Save(archiveFile.Value(), progress); - } - else // sources not specified, extract must have been specified - { - archive.Extract(archiveFile.Value(), extract.Value(), progress); - - } - - return 0; - }); - - return app.Execute(args); - } - } -} diff --git a/src/dotnet-archive/dotnet-archive.csproj b/src/dotnet-archive/dotnet-archive.csproj deleted file mode 100644 index a983cefce..000000000 --- a/src/dotnet-archive/dotnet-archive.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - $(CliTargetFramework) - Exe - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/Archiver/Archiver.csproj b/tools/Archiver/Archiver.csproj deleted file mode 100644 index 2a63e855f..000000000 --- a/tools/Archiver/Archiver.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - netcoreapp2.0 - Exe - $(CLI_SharedFrameworkVersion) - - - - - - - - - - - - - - - \ No newline at end of file From 15c2bc2975f53d67f202c55337ab81b157d48120 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Sun, 30 Apr 2017 16:06:15 -0700 Subject: [PATCH 40/68] Creating a signing target that will handle resolver files. --- build/Signing.proj | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build/Signing.proj b/build/Signing.proj index 267f0c975..3fa6d63b4 100644 --- a/build/Signing.proj +++ b/build/Signing.proj @@ -18,6 +18,7 @@ $(BaseOutputDirectory)/stage2 $(BaseOutputDirectory)/stage2compilation $(BaseOutputDirectory)/packages + $(BaseOutputDirectory)/intermediate/MSBuildSdkResolver @@ -71,6 +72,19 @@ + + + + + $(SdkResolverOutputDirectory) + + + + $(InternalCertificateId) + + + + From 1a52f8457aa84491189d6626dc3b820c08c49e34 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 1 May 2017 12:19:26 -0700 Subject: [PATCH 41/68] The 'AspNetRuntimePackageStorePublishDirectory' needs to be very short due to path length constraints on Win8.1 --- build/OutputDirectories.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index 904e381f7..ad1de70b0 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -10,7 +10,8 @@ $(BaseOutputDirectory)/intermediate $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish - $(IntermediateDirectory)/AspNetCoreRuntimeStore + + $(IntermediateDirectory)/AspRT $(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) From ad74a8bb96e8e68b521321652a16fd026351bb9a Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 1 May 2017 13:08:16 -0700 Subject: [PATCH 42/68] Even shorter... --- build/OutputDirectories.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index ad1de70b0..a7734482d 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -11,7 +11,7 @@ $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish - $(IntermediateDirectory)/AspRT + $(IntermediateDirectory)/RT $(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) From c6bc52c072e3240f633e19ab3598b9ed2d314e69 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 1 May 2017 13:14:16 -0700 Subject: [PATCH 43/68] The 'AspNetRuntimePackageStorePublishDirectory' needs to be even shorter... --- build/OutputDirectories.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/OutputDirectories.props b/build/OutputDirectories.props index a7734482d..f780e3656 100644 --- a/build/OutputDirectories.props +++ b/build/OutputDirectories.props @@ -11,7 +11,7 @@ $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish - $(IntermediateDirectory)/RT + $(BaseOutputDirectory)/AspRT $(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish $(RepoRoot)/artifacts/testpackages/ $(OutputDirectory)/dotnet$(ExeExtension) From 7bcf72917be5840574688eeb9e731d52dc3a31f3 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Tue, 2 May 2017 04:27:51 +0000 Subject: [PATCH 44/68] Update CoreSetup to preview1-002106 --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ebafd05a3..1b4749703 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.0.0-preview1-002101-00 + 2.0.0-preview1-002106-00 15.3.0-preview-000111-01 2.0.0-rc4-61325-08 2.0.0-alpha-20170428-1 @@ -14,8 +14,8 @@ 1.0.0-beta2-20170427-205 1.0.0-beta2-20170427-205 1.0.0-beta2-20170427-205 - 2.0.0-preview1-002101 - 2.0.0-preview1-002101 + 2.0.0-preview1-002106 + 2.0.0-preview1-002106 0.1.0-alpha-142 From 6ada5b7596877e8c0fd260f4649179e0bcffb1aa Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 1 May 2017 21:42:51 -0700 Subject: [PATCH 45/68] Inserting 'AspNetCorePackageStoreLib.wixlib' into the 'dotnet-dev-win' bundles. --- build/package/Installer.MSI.targets | 1 + packaging/windows/clisdk/bundle.wxs | 5 +++++ packaging/windows/clisdk/generatebundle.ps1 | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/build/package/Installer.MSI.targets b/build/package/Installer.MSI.targets index c132efdb0..c11174f2d 100644 --- a/build/package/Installer.MSI.targets +++ b/build/package/Installer.MSI.targets @@ -115,6 +115,7 @@ + + + + + diff --git a/packaging/windows/clisdk/generatebundle.ps1 b/packaging/windows/clisdk/generatebundle.ps1 index 2677fdd46..da5b4c83c 100644 --- a/packaging/windows/clisdk/generatebundle.ps1 +++ b/packaging/windows/clisdk/generatebundle.ps1 @@ -3,6 +3,7 @@ param( [Parameter(Mandatory=$true)][string]$CLISDKMSIFile, + [Parameter(Mandatory=$true)][string]$ASPNETRuntimeWixLibFile, [Parameter(Mandatory=$true)][string]$SharedFxMSIFile, [Parameter(Mandatory=$true)][string]$HostFxrMSIFile, [Parameter(Mandatory=$true)][string]$SharedHostMSIFile, @@ -69,6 +70,7 @@ function RunLightForBundle .\light.exe -nologo ` -cultures:en-us ` bundle.wixobj ` + $ASPNETRuntimeWixlibFile ` -ext WixBalExtension.dll ` -ext WixUtilExtension.dll ` -ext WixTagExtension.dll ` @@ -91,6 +93,11 @@ if(!(Test-Path $CLISDKMSIFile)) throw "$CLISDKMSIFile not found" } +if(!(Test-Path $ASPNETRuntimeWixLibFile)) +{ + throw "$ASPNETRuntimeWixLibFile not found" +} + Write-Host "Creating dotnet Bundle at $DotnetBundleOutput" if([string]::IsNullOrEmpty($WixRoot)) From b8dd2b4619b74dd23e66178c1b55bb0948129c38 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 1 May 2017 21:46:51 -0700 Subject: [PATCH 46/68] Updating msbuild, SDK and Web SDK. --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ebafd05a3..5059ada48 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,11 +2,11 @@ 2.0.0-preview1-002101-00 - 15.3.0-preview-000111-01 + 15.3.0-preview-000117-01 2.0.0-rc4-61325-08 - 2.0.0-alpha-20170428-1 + 2.0.0-alpha-20170502-2 4.3.0-beta1-2418 - 1.0.0-rel-20170413-451 + 1.0.0-rel-20170501-473 15.1.0-preview-20170414-04 $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) From 416ea8166eba3cd8a3e25575fafcf25341c66019 Mon Sep 17 00:00:00 2001 From: Livar Date: Tue, 2 May 2017 12:03:52 -0700 Subject: [PATCH 47/68] Updating the aspnet runtime version to 56 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 38c6ffb4c..56ebfcf38 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,7 +17,7 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 - 2.0.0-preview1-34 + 2.0.0-preview1-56 From 5a6efef0e2a4e1e9ed47e9d998c2c10fc5b7829f Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 2 May 2017 12:20:25 -0700 Subject: [PATCH 48/68] Updating the aspnet runtime version and handling tar.gz there. --- build/BundledRuntimes.props | 2 +- build/DependencyVersions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 19897dca1..d0c83009f 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -38,7 +38,7 @@ $(OSName) linux - Build.RS.$(AspNetCoreRuntimeInstallerArchiveFileNameOSToken).zip + Build.RS.$(AspNetCoreRuntimeInstallerArchiveFileNameOSToken)$(ArchiveExtension) $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerArchiveFileName) AspNetCorePackageStoreLib$(Architecture).wixlib diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f331b31f9..a8b481c80 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,7 +17,7 @@ 2.0.0-preview1-002101 2.0.0-preview1-002101 0.1.0-alpha-142 - 2.0.0-preview1-36 + 2.0.0-preview1-56 From 9387702b7a1475f56ca877e1c92e306a1bf021e8 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 2 May 2017 12:37:29 -0700 Subject: [PATCH 49/68] Fixing the failing test by using a package that is not part of the asp.net runtime. --- .../NewtonsoftProfile/NewtonsoftFilterProfile.xml | 3 --- .../NewtonsoftProfile/NewtonsoftProfile.xml | 5 ----- .../NuGetConfigDependentProject.csproj} | 2 +- .../Program.cs | 12 +++--------- .../NuGetConfigProfile/NuGetConfigFilterProfile.xml | 3 +++ .../NuGetConfigProfile/NuGetConfigProfile.xml | 5 +++++ .../GivenDotnetStoresAndPublishesProjects.cs | 8 ++++---- 7 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml delete mode 100644 TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml rename TestAssets/TestProjects/{NewtonSoftDependentProject/NewtonSoftDependentProject.csproj => NuGetConfigDependentProject/NuGetConfigDependentProject.csproj} (70%) rename TestAssets/TestProjects/{NewtonSoftDependentProject => NuGetConfigDependentProject}/Program.cs (52%) create mode 100644 TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigFilterProfile.xml create mode 100644 TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigProfile.xml diff --git a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml deleted file mode 100644 index 8f5abe95e..000000000 --- a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml deleted file mode 100644 index 6cc6c5cdc..000000000 --- a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj b/TestAssets/TestProjects/NuGetConfigDependentProject/NuGetConfigDependentProject.csproj similarity index 70% rename from TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj rename to TestAssets/TestProjects/NuGetConfigDependentProject/NuGetConfigDependentProject.csproj index 48bba3bea..fd76d5489 100644 --- a/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj +++ b/TestAssets/TestProjects/NuGetConfigDependentProject/NuGetConfigDependentProject.csproj @@ -6,6 +6,6 @@ - + diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs b/TestAssets/TestProjects/NuGetConfigDependentProject/Program.cs similarity index 52% rename from TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs rename to TestAssets/TestProjects/NuGetConfigDependentProject/Program.cs index 2debeaadb..f6d539fe6 100644 --- a/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs +++ b/TestAssets/TestProjects/NuGetConfigDependentProject/Program.cs @@ -3,20 +3,14 @@ using System; using System.Collections; -using Newtonsoft.Json.Linq; +using NuGet.Configuration; class Program { public static void Main(string[] args) { - ArrayList argList = new ArrayList(args); - JObject jObject = new JObject(); + var settingValue = new SettingValue("key", "value", false); - foreach (string arg in argList) - { - jObject[arg] = arg; - } - - Console.WriteLine(jObject.ToString()); + Console.WriteLine(settingValue.Key); } } diff --git a/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigFilterProfile.xml b/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigFilterProfile.xml new file mode 100644 index 000000000..cb238e3f0 --- /dev/null +++ b/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigFilterProfile.xml @@ -0,0 +1,3 @@ + + + diff --git a/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigProfile.xml b/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigProfile.xml new file mode 100644 index 000000000..da70b1394 --- /dev/null +++ b/TestAssets/TestProjects/NuGetConfigProfile/NuGetConfigProfile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/dotnet-store.Tests/GivenDotnetStoresAndPublishesProjects.cs b/test/dotnet-store.Tests/GivenDotnetStoresAndPublishesProjects.cs index d10dcca6b..e2845ec19 100644 --- a/test/dotnet-store.Tests/GivenDotnetStoresAndPublishesProjects.cs +++ b/test/dotnet-store.Tests/GivenDotnetStoresAndPublishesProjects.cs @@ -70,9 +70,9 @@ namespace Microsoft.DotNet.Cli.Publish.Tests [Fact] public void AppFailsDueToMissingCache() { - var testAppName = "NewtonSoftDependentProject"; - var profileProjectName = "NewtonsoftProfile"; - var targetManifestFileName = "NewtonsoftFilterProfile.xml"; + var testAppName = "NuGetConfigDependentProject"; + var profileProjectName = "NuGetConfigProfile"; + var targetManifestFileName = "NuGetConfigFilterProfile.xml"; var testInstance = TestAssets.Get(testAppName) .CreateInstance() @@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests new DotnetCommand() .ExecuteWithCapturedOutput(outputDll) .Should().Fail() - .And.HaveStdErrContaining($"Error: assembly specified in the dependencies manifest was not found probably due to missing runtime store associated with {targetManifestFileName} -- package: 'Newtonsoft.Json',"); + .And.HaveStdErrContaining($"Error: assembly specified in the dependencies manifest was not found probably due to missing runtime store associated with {targetManifestFileName} -- package: 'NuGet.Configuration',"); } [Fact] From aac69168c25128af78bba424c708f980c2866dbd Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 2 May 2017 13:36:52 -0700 Subject: [PATCH 50/68] Adding NewtonSoftDependentProject test asset back. --- .../NewtonSoftDependentProject.csproj | 11 ++++++++++ .../NewtonSoftDependentProject/Program.cs | 22 +++++++++++++++++++ .../NewtonsoftFilterProfile.xml | 3 +++ .../NewtonsoftProfile/NewtonsoftProfile.xml | 5 +++++ 4 files changed, 41 insertions(+) create mode 100644 TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj create mode 100644 TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs create mode 100644 TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml create mode 100644 TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj b/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj new file mode 100644 index 000000000..48bba3bea --- /dev/null +++ b/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj @@ -0,0 +1,11 @@ + + + + Exe + netcoreapp2.0 + + + + + + diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs b/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs new file mode 100644 index 000000000..2debeaadb --- /dev/null +++ b/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections; +using Newtonsoft.Json.Linq; + +class Program +{ + public static void Main(string[] args) + { + ArrayList argList = new ArrayList(args); + JObject jObject = new JObject(); + + foreach (string arg in argList) + { + jObject[arg] = arg; + } + + Console.WriteLine(jObject.ToString()); + } +} diff --git a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml new file mode 100644 index 000000000..8f5abe95e --- /dev/null +++ b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftFilterProfile.xml @@ -0,0 +1,3 @@ + + + diff --git a/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml new file mode 100644 index 000000000..6cc6c5cdc --- /dev/null +++ b/TestAssets/TestProjects/NewtonsoftProfile/NewtonsoftProfile.xml @@ -0,0 +1,5 @@ + + + + + From 0b341a9afbb46ea7f7d5ce163fcd7d0bba062d9e Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 2 May 2017 15:18:10 -0700 Subject: [PATCH 51/68] Fixing a merge that ended up with double versions in the asp.net runtime store url. --- build/BundledRuntimes.props | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 3ccf6d91c..8abc1c555 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -31,7 +31,7 @@ - $(CoreSetupBlobRootUrl)aspnetcore/store + $(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion) $(OSName)$(Architecture) @@ -45,10 +45,6 @@ $(PackagesDirectory)/$(AspNetCoreRuntimeInstallerWixLibFileName) - - $(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion) - - <_DownloadAndExtractItem Include="CombinedSharedHostAndFrameworkArchive" Condition="!Exists('$(CombinedSharedHostAndFrameworkArchive)')"> @@ -80,14 +76,14 @@ <_DownloadAndExtractItem Include="AspNetCoreRuntimeInstallerWixLibFile" Condition=" '$(AspNetCoreRuntimeInstallerWixLibFile)' != '' And !Exists('$(AspNetCoreRuntimeInstallerWixLibFile)')"> - $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeVersion)/$(AspNetCoreRuntimeInstallerWixLibFileName) + $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeInstallerWixLibFileName) $(AspNetCoreRuntimeInstallerWixLibFile) <_DownloadAndExtractItem Include="AspNetCoreRuntimeInstallerArchiveFile" Condition="!Exists('$(AspNetCoreRuntimeInstallerArchiveFile)')"> - $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeVersion)/$(AspNetCoreRuntimeInstallerArchiveFileName) + $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeInstallerArchiveFileName) $(AspNetCoreRuntimeInstallerArchiveFile) $(AspNetRuntimePackageStorePublishDirectory) From dd827c53934b09212130500b5a71be302060aed8 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Tue, 2 May 2017 13:01:52 -0700 Subject: [PATCH 52/68] Update ASP.NET to 24801 - SetupCrossgen build 56 --- build/DependencyVersions.props | 4 ++-- test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config | 7 ++----- test/dotnet-new.Tests/NuGet.tempaspnetpatch.config | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f599008f4..8be95b5c7 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -12,8 +12,8 @@ $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) 1.0.0-beta2-20170427-205 - 1.0.0-beta2-20170427-205 - 1.0.0-beta2-20170427-205 + 1.0.0-beta2-20170502-215 + 1.0.0-beta2-20170502-215 2.0.0-preview1-002106 2.0.0-preview1-002106 0.1.0-alpha-142 diff --git a/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config b/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config index eaf5b585e..1f41d2665 100644 --- a/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config +++ b/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config @@ -3,11 +3,8 @@ - - - - - + + \ No newline at end of file diff --git a/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config b/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config index 80a6898ca..1f41d2665 100644 --- a/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config +++ b/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config @@ -3,10 +3,8 @@ - - - - + + \ No newline at end of file From b90b191ef0d4b019982bcfe60669f6fde5a2ac21 Mon Sep 17 00:00:00 2001 From: Faizan2304 Date: Tue, 2 May 2017 21:30:51 -0700 Subject: [PATCH 53/68] Insert Microsoft.TestPlatform.cli for update3 preview1 (#6420) * Fix test issue failing with PathTooLongIssue (cherry picked from commit 340254f7742201c74ed1a5c349bdca89113bd5dc) * fix for issues: 1) https://github.com/Microsoft/vstest/issues/755 2) https://github.com/Microsoft/vstest/issues/687 3) https://github.com/Microsoft/vstest/issues/737 (cherry picked from commit 0e93b2a5d4734637538781fa5401ed81a31eea0f) * use new version * Update version * Fix pathtoolong issue * Fix test --- .../{VSTestDotNetCore => VSTestCore}/Tests.cs | 0 .../VSTestCore.csproj} | 0 .../Tests.cs | 0 .../VSTestDesktopAndNetCore.csproj | 1 - .../UnitTest1.cs | 0 .../XunitCore.csproj} | 0 .../UnitTest1.cs | 0 .../VSTestXunitDesktopAndNetCore.csproj | 0 build/DependencyVersions.props | 2 +- .../dotnet-test/LocalizableStrings.cs | 19 ++++- src/dotnet/commands/dotnet-test/Program.cs | 24 +++++- .../commands/dotnet-test/TestCommandParser.cs | 7 ++ .../GivenThatIWantToRestoreApp.cs | 2 +- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 14 ++-- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 73 ++++++++++--------- test/dotnet-vstest.Tests/VSTestTests.cs | 2 +- 16 files changed, 93 insertions(+), 51 deletions(-) rename TestAssets/TestProjects/{VSTestDotNetCore => VSTestCore}/Tests.cs (100%) rename TestAssets/TestProjects/{VSTestDotNetCore/VSTestDotNetCore.csproj => VSTestCore/VSTestCore.csproj} (100%) rename TestAssets/TestProjects/{VSTestDesktopAndNetCore => VSTestMulti}/Tests.cs (100%) rename TestAssets/TestProjects/{VSTestDesktopAndNetCore => VSTestMulti}/VSTestDesktopAndNetCore.csproj (95%) rename TestAssets/TestProjects/{VSTestXunitDotNetCore => XunitCore}/UnitTest1.cs (100%) rename TestAssets/TestProjects/{VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj => XunitCore/XunitCore.csproj} (100%) rename TestAssets/TestProjects/{VSTestXunitDesktopAndNetCore => XunitMulti}/UnitTest1.cs (100%) rename TestAssets/TestProjects/{VSTestXunitDesktopAndNetCore => XunitMulti}/VSTestXunitDesktopAndNetCore.csproj (100%) diff --git a/TestAssets/TestProjects/VSTestDotNetCore/Tests.cs b/TestAssets/TestProjects/VSTestCore/Tests.cs similarity index 100% rename from TestAssets/TestProjects/VSTestDotNetCore/Tests.cs rename to TestAssets/TestProjects/VSTestCore/Tests.cs diff --git a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj b/TestAssets/TestProjects/VSTestCore/VSTestCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj rename to TestAssets/TestProjects/VSTestCore/VSTestCore.csproj diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/Tests.cs b/TestAssets/TestProjects/VSTestMulti/Tests.cs similarity index 100% rename from TestAssets/TestProjects/VSTestDesktopAndNetCore/Tests.cs rename to TestAssets/TestProjects/VSTestMulti/Tests.cs diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestMulti/VSTestDesktopAndNetCore.csproj similarity index 95% rename from TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj rename to TestAssets/TestProjects/VSTestMulti/VSTestDesktopAndNetCore.csproj index 9cd7184f8..1a8fb8e53 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestMulti/VSTestDesktopAndNetCore.csproj @@ -2,7 +2,6 @@ - Exe net46;netcoreapp2.0 diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/UnitTest1.cs b/TestAssets/TestProjects/XunitCore/UnitTest1.cs similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDotNetCore/UnitTest1.cs rename to TestAssets/TestProjects/XunitCore/UnitTest1.cs diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj b/TestAssets/TestProjects/XunitCore/XunitCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj rename to TestAssets/TestProjects/XunitCore/XunitCore.csproj diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/UnitTest1.cs b/TestAssets/TestProjects/XunitMulti/UnitTest1.cs similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/UnitTest1.cs rename to TestAssets/TestProjects/XunitMulti/UnitTest1.cs diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj b/TestAssets/TestProjects/XunitMulti/VSTestXunitDesktopAndNetCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj rename to TestAssets/TestProjects/XunitMulti/VSTestXunitDesktopAndNetCore.csproj diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f599008f4..c4bb77b81 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -7,7 +7,7 @@ 2.0.0-alpha-20170502-2 4.3.0-beta1-2418 1.0.0-rel-20170501-473 - 15.1.0-preview-20170414-04 + 15.3.0-preview-20170502-03 $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) diff --git a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs index 6056e0fc2..fbe9ba5c0 100644 --- a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs @@ -37,7 +37,8 @@ namespace Microsoft.DotNet.Tools.Test public const string CmdLoggerOption = "LoggerUri/FriendlyName"; public const string CmdLoggerDescription = @"Specify a logger for test results. - Example: --logger ""trx[;LogFileName=]"""; + Example: --logger ""trx[;LogFileName=]"" + More info on logger arguments support:https://aka.ms/vstest-report"; public const string CmdConfiguration = "CONFIGURATION"; @@ -58,12 +59,22 @@ namespace Microsoft.DotNet.Tools.Test public const string CmdNoBuildDescription = @"Do not build project before testing."; - public const string RunSettingsArgsHelpText = @"Any extra command-line runsettings arguments that should be passed to vstest. See 'dotnet vstest --help' for available options. - Example: -- RunConfiguration.ResultsDirectory=""C:\users\user\desktop\Results Directory"" MSTest.DeploymentEnabled=false"; - public const string CmdResultsDirectoryDescription = @"The directory where the test results are going to be placed. The specified directory will be created if it does not exist. Example: --results-directory "; public const string CmdPathToResultsDirectory = "PATH_TO_RESULTS_DIRECTORY"; + + public const string RunSettingsArgumentsDescription = @" + +RunSettings arguments: + Arguments to pass runsettings configurations through commandline. Arguments may be specified as name-value pair of the form [name]=[value] after ""-- "". Note the space after --. + Use a space to separate multiple[name] =[value]. + More info on RunSettings arguments support: https://aka.ms/vstest-runsettings-arguments + Example: dotnet test -- MSTest.DeploymentEnabled=false MSTest.MapInconclusiveToFailed=True"; + + public const string cmdCollectFriendlyName = "DATA_COLLECTOR_FRIENDLY_NAME"; + + public const string cmdCollectDescription = @"Enables data collector for the test run. + More info here : https://aka.ms/vstest-collect"; } } diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index 913181a20..a7f9a0380 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Tools.Test { } - public static TestCommand FromArgs(string[] args, string msbuildPath=null) + public static TestCommand FromArgs(string[] args, string msbuildPath = null) { var msbuildArgs = new List() { @@ -34,6 +34,7 @@ namespace Microsoft.DotNet.Tools.Test var result = parser.ParseFrom("dotnet test", args); + UpdateRunSettingsArgumentsText(); result.ShowHelpOrErrorIfAppropriate(); var parsedTest = result["dotnet"]["test"]; @@ -42,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Test msbuildArgs.AddRange(parsedTest.Arguments); - var runSettingsOptions = + var runSettingsOptions = result.UnparsedTokens .Select(GetSemiColonEscapedString); @@ -53,6 +54,17 @@ namespace Microsoft.DotNet.Tools.Test msbuildArgs.Add($"/p:VSTestCLIRunSettings=\"{runSettingsArg}\""); } + var verbosityArg = msbuildArgs.LastOrDefault(arg => arg.StartsWith("/verbosity")); + + if (!string.IsNullOrEmpty(verbosityArg)) + { + var verbosity = verbosityArg.Split(':'); + if (verbosity.Length == 2) + { + msbuildArgs.Add($"/p:VSTestVerbosity={verbosity[1]}"); + } + } + return new TestCommand(msbuildArgs, msbuildPath); } @@ -61,7 +73,7 @@ namespace Microsoft.DotNet.Tools.Test DebugHelper.HandleDebugSwitch(ref args); TestCommand cmd; - + try { cmd = FromArgs(args); @@ -96,5 +108,11 @@ namespace Microsoft.DotNet.Tools.Test return array; } + + private static void UpdateRunSettingsArgumentsText() + { + DefaultHelpViewText.Synopsis.AdditionalArguments = " [[--] ...]]"; + DefaultHelpViewText.AdditionalArgumentsSection = LocalizableStrings.RunSettingsArgumentsDescription; + } } } diff --git a/src/dotnet/commands/dotnet-test/TestCommandParser.cs b/src/dotnet/commands/dotnet-test/TestCommandParser.cs index c79dee524..a17aa20a7 100644 --- a/src/dotnet/commands/dotnet-test/TestCommandParser.cs +++ b/src/dotnet/commands/dotnet-test/TestCommandParser.cs @@ -14,6 +14,7 @@ namespace Microsoft.DotNet.Cli Accept.ZeroOrMoreArguments() .With(name: LocalizableStrings.CmdArgProject, description: LocalizableStrings.CmdArgDescription), + false, CommonOptions.HelpOption(), Create.Option( "-s|--settings", @@ -74,6 +75,12 @@ namespace Microsoft.DotNet.Cli Accept.ExactlyOneArgument() .With(name: LocalizableStrings.CmdPathToResultsDirectory) .ForwardAsSingle(o => $"/p:VSTestResultsDirectory={o.Arguments.Single()}")), + Create.Option( + "--collect", + LocalizableStrings.cmdCollectDescription, + Accept.OneOrMoreArguments() + .With(name: LocalizableStrings.cmdCollectFriendlyName) + .ForwardAsSingle(o => $"/p:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")), CommonOptions.VerbosityOption()); private static string GetSemiColonEsacpedstring(string arg) diff --git a/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs b/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs index 6b6f1b6b9..3b5c44b42 100644 --- a/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs +++ b/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs @@ -73,7 +73,7 @@ namespace Microsoft.DotNet.Restore.Tests [Fact] public void ItRestoresTestAppToSpecificDirectory() { - var rootPath = TestAssets.Get("VSTestDotNetCore").CreateInstance().WithSourceFiles().Root.FullName; + var rootPath = TestAssets.Get("VSTestCore").CreateInstance().WithSourceFiles().Root.FullName; string dir = "pkgs"; string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir)); diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs index b6ee1198b..a111db3c3 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -12,11 +12,11 @@ namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM : TestBase { - [WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4616")] + [WindowsOnlyFact] public void MStestMultiTFM() { - var testProjectDirectory = TestAssets.Get("VSTestDesktopAndNetCore") - .CreateInstance() + var testProjectDirectory = TestAssets.Get("VSTestMulti") + .CreateInstance("1") .WithSourceFiles() .WithNuGetConfig(new RepoDirectoriesProvider().TestPackages) .Root; @@ -45,15 +45,15 @@ namespace Microsoft.DotNet.Cli.Test.Tests [WindowsOnlyFact] public void XunitMultiTFM() { - // Copy VSTestXunitDesktopAndNetCore project in output directory of project dotnet-test.Tests - string testAppName = "VSTestXunitDesktopAndNetCore"; + // Copy XunitMulti project in output directory of project dotnet-test.Tests + string testAppName = "XunitMulti"; var testInstance = TestAssets.Get(testAppName) - .CreateInstance() + .CreateInstance("2") .WithSourceFiles(); var testProjectDirectory = testInstance.Root.FullName; - // Restore project VSTestXunitDesktopAndNetCore + // Restore project XunitMulti new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index c3630da20..b20fb70ef 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -17,20 +17,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void MSTestSingleTFM() { - // Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestDotNetCore"; - var testInstance = TestAssets.Get(testAppName) - .CreateInstance() - .WithSourceFiles(); - - var testProjectDirectory = testInstance.Root.FullName; - - // Restore project VSTestDotNetCore - new RestoreCommand() - .WithWorkingDirectory(testProjectDirectory) - .Execute() - .Should() - .Pass(); + var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("3"); // Call test CommandResult result = new DotnetTestCommand() @@ -47,15 +34,15 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void XunitSingleTFM() { - // Copy VSTestXunitDotNetCore project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestXunitDotNetCore"; + // Copy XunitCore project in output directory of project dotnet-vstest.Tests + string testAppName = "XunitCore"; var testInstance = TestAssets.Get(testAppName) - .CreateInstance() + .CreateInstance("4") .WithSourceFiles(); var testProjectDirectory = testInstance.Root.FullName; - // Restore project VSTestXunitDotNetCore + // Restore project XunitCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() @@ -77,11 +64,11 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { - // Copy and restore VSTestDotNetCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp(); + // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests + var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("5"); string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string expectedError = Path.Combine(testProjectDirectory, "bin", - configuration, "netcoreapp2.0", "VSTestDotNetCore.dll"); + configuration, "netcoreapp2.0", "VSTestCore.dll"); expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found."; // Call test @@ -96,10 +83,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch() { - // Copy and restore VSTestDotNetCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp(); + // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests + var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("6"); - string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TestResults", "netcoreappx.y"); + string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TR", "x.y"); // Delete trxLoggerDirectory if it exist if (Directory.Exists(trxLoggerDirectory)) @@ -127,10 +114,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void ItCreatesTrxReportInTheSpecifiedResultsDirectoryByArgs() { - // Copy and restore VSTestDotNetCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp(); + // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests + var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("7"); - string trxLoggerDirectory = Path.Combine(testProjectDirectory, "ResultsDirectory"); + string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD"); // Delete trxLoggerDirectory if it exist if (Directory.Exists(trxLoggerDirectory)) @@ -155,12 +142,14 @@ namespace Microsoft.DotNet.Cli.Test.Tests } } - [Fact(Skip = "https://github.com/dotnet/cli/issues/5035")] + [Fact] public void ItBuildsAndTestsAppWhenRestoringToSpecificDirectory() { - var rootPath = TestAssets.Get("VSTestDotNetCore").CreateInstance().WithSourceFiles().Root.FullName; + // Creating folder with name short name "RestoreTest" to avoid PathTooLongException + var rootPath = TestAssets.Get("VSTestCore").CreateInstance("8").WithSourceFiles().Root.FullName; - string dir = "pkgs"; + // Moving pkgs folder on top to avoid PathTooLongException + string dir = @"..\..\..\..\pkgs"; string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir)); string args = $"--packages \"{dir}\""; @@ -186,17 +175,35 @@ namespace Microsoft.DotNet.Cli.Test.Tests result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest"); } + [Fact] + public void ItUsesVerbosityPassedToDefineVerbosityOfConsoleLoggerOfTheTests() + { + // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests + var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("9"); + + // Call test + CommandResult result = new DotnetTestCommand() + .WithWorkingDirectory(testProjectDirectory) + .ExecuteWithCapturedOutput("-v q"); + + // Verify + result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0."); + result.StdOut.Should().NotContain("Passed TestNamespace.VSTestTests.VSTestPassTest"); + result.StdOut.Should().NotContain("Failed TestNamespace.VSTestTests.VSTestFailTest"); + result.ExitCode.Should().Be(1); + } + private string CopyAndRestoreVSTestDotNetCoreTestApp([CallerMemberName] string callingMethod = "") { - // Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestDotNetCore"; + // Copy VSTestCore project in output directory of project dotnet-vstest.Tests + string testAppName = "VSTestCore"; var testInstance = TestAssets.Get(testAppName) .CreateInstance(callingMethod) .WithSourceFiles(); var testProjectDirectory = testInstance.Root.FullName; - // Restore project VSTestDotNetCore + // Restore project VSTestCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() diff --git a/test/dotnet-vstest.Tests/VSTestTests.cs b/test/dotnet-vstest.Tests/VSTestTests.cs index cd7b0e8e9..0dba88ce5 100644 --- a/test/dotnet-vstest.Tests/VSTestTests.cs +++ b/test/dotnet-vstest.Tests/VSTestTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests [Fact] public void TestsFromAGivenContainerShouldRunWithExpectedOutput() { - var testAppName = "VSTestDotNetCore"; + var testAppName = "VSTestCore"; var testRoot = TestAssets.Get(testAppName) .CreateInstance() .WithSourceFiles() From 9f8ab82a6ce387566bc2fd7789130c339d8fde19 Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 3 May 2017 10:24:23 -0700 Subject: [PATCH 54/68] Run dotnet new command as current user in installer If not, the dotnet new will run as root and the cache folders will be in root ownership How to get current user https://apple.stackexchange.com/questions/144159/how-can-i-determine-the-invoking-user-in-an-apple-installer-postinstall-script --- packaging/osx/clisdk/scripts/postinstall | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packaging/osx/clisdk/scripts/postinstall b/packaging/osx/clisdk/scripts/postinstall index 4d69748e9..54ea36c0d 100755 --- a/packaging/osx/clisdk/scripts/postinstall +++ b/packaging/osx/clisdk/scripts/postinstall @@ -11,7 +11,8 @@ INSTALL_DESTINATION=$2 # A temporary fix for the permissions issue(s) chmod -R 755 $INSTALL_DESTINATION -# Run 'dotnet new' to trigger the first time experience to initialize the cache -$INSTALL_DESTINATION/dotnet new > /dev/null 2>&1 || true +# Run 'dotnet new' as user to trigger the first time experience to initialize the cache +INSTALLER_USER=$(stat -f '%Su' $HOME) +su - $INSTALLER_USER -c "$INSTALL_DESTINATION/dotnet new > /dev/null 2>&1 || true" exit 0 From c9295d1df7d1035cb4a576ac2dff5dfc8dbf97bd Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 26 Apr 2017 12:12:25 -0700 Subject: [PATCH 55/68] Run dotnet new after install to prime cache for deb Copy postinst to correct directory Can only rely on env for get dotnet command Print telemetry notice anyway --- build/package/Installer.DEB.proj | 30 ++++++++++++++++++----------- build/package/Installer.DEB.targets | 5 +++++ packaging/deb/postinst | 12 ++++++++++++ 3 files changed, 36 insertions(+), 11 deletions(-) mode change 100644 => 100755 packaging/deb/postinst diff --git a/build/package/Installer.DEB.proj b/build/package/Installer.DEB.proj index f151ba1e5..6a6d49b56 100644 --- a/build/package/Installer.DEB.proj +++ b/build/package/Installer.DEB.proj @@ -10,7 +10,7 @@ TestDebuild; BuildSdkDeb; TestSdkDeb;" - Condition=" '$(OSName)' == 'ubuntu' " + Condition=" '$(OSName)' == 'ubuntu' " Outputs="@(GeneratedInstallers)"/> - + + + + - @@ -58,12 +66,12 @@ PackageName="$(SdkDebianPackageName)" PackageVersion="$(SdkVersion)" WorkingDirectory="$(DotnetDebToolDir)" /> - + - + - - + + @@ -158,11 +166,11 @@ - + - + diff --git a/build/package/Installer.DEB.targets b/build/package/Installer.DEB.targets index 1a041fe20..c4f0d1797 100644 --- a/build/package/Installer.DEB.targets +++ b/build/package/Installer.DEB.targets @@ -75,6 +75,11 @@ $(LayoutDirectory)/debian_config.json + + $(RepoRoot)/packaging/deb/postinst + $(LayoutDirectory)/debian/postinst + + $(SharedFxDebianPackageName) diff --git a/packaging/deb/postinst b/packaging/deb/postinst old mode 100644 new mode 100755 index b000f5933..6bfb2cb7a --- a/packaging/deb/postinst +++ b/packaging/deb/postinst @@ -1,3 +1,15 @@ #!/usr/bin/env sh echo "This software may collect information about you and your use of the software, and send that to Microsoft." echo "Please visit http://aka.ms/dotnet-cli-eula for more information." + +# Run 'dotnet new' to trigger the first time experience to initialize the cache +echo "Welcome to .NET Core! +--------------------- +Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. + +Telemetry +-------------- +The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. +You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. +You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry." +dotnet new > /dev/null 2>&1 || true From fa9c4efc82f641a281323c5b2db05fb6387af4e2 Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 3 May 2017 18:38:41 +0000 Subject: [PATCH 56/68] Run as user instead of root for dotnet new --- packaging/deb/postinst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/deb/postinst b/packaging/deb/postinst index 6bfb2cb7a..aac8be85c 100755 --- a/packaging/deb/postinst +++ b/packaging/deb/postinst @@ -2,7 +2,7 @@ echo "This software may collect information about you and your use of the software, and send that to Microsoft." echo "Please visit http://aka.ms/dotnet-cli-eula for more information." -# Run 'dotnet new' to trigger the first time experience to initialize the cache +# Run 'dotnet new' as the user to trigger the first time experience to initialize the cache echo "Welcome to .NET Core! --------------------- Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. @@ -12,4 +12,4 @@ Telemetry The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry." -dotnet new > /dev/null 2>&1 || true +su - $SUDO_USER -c "dotnet new > /dev/null 2>&1 || true" From 0dc1b53482d4511f834d9c8960977fad45f9c712 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 3 May 2017 14:12:50 -0700 Subject: [PATCH 57/68] Switches the fallback folder under Nuget.Config to a package source, since we have issues for 1.0 apps using fallback folders. --- src/Microsoft.DotNet.Configurer/NuGetConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Configurer/NuGetConfig.cs b/src/Microsoft.DotNet.Configurer/NuGetConfig.cs index fb7b9292c..ec5ffc4dd 100644 --- a/src/Microsoft.DotNet.Configurer/NuGetConfig.cs +++ b/src/Microsoft.DotNet.Configurer/NuGetConfig.cs @@ -9,7 +9,7 @@ namespace Microsoft.DotNet.Configurer { public class NuGetConfig : INuGetConfig { - public const string FallbackPackageFolders = "fallbackPackageFolders"; + public const string FallbackPackageFolders = "packageSources"; private ISettings _settings; From 3e42e8233bbcf92710f7d3d214d7d62393e5aab6 Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 3 May 2017 22:15:34 +0000 Subject: [PATCH 58/68] Add asp.net runtime to SDK deb package Copy the runtime file to the deb layout folder, the deb tool picks it up from there --- build/package/Installer.DEB.proj | 8 ++++++++ build/package/Installer.DEB.targets | 2 ++ 2 files changed, 10 insertions(+) diff --git a/build/package/Installer.DEB.proj b/build/package/Installer.DEB.proj index 6a6d49b56..2b5875a51 100644 --- a/build/package/Installer.DEB.proj +++ b/build/package/Installer.DEB.proj @@ -33,6 +33,14 @@ SkipUnchangedFiles="False" UseHardlinksIfPossible="False" /> + + + $(RepoRoot)/Documentation/manpages $(RepoRoot)/test/EndToEnd/EndToEnd.csproj $(OutputDirectory)/sdk + $(AspNetRuntimePackageStorePublishDirectory) + From 1736c388b027e549794f5660073f3d58ffe02fa5 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 3 May 2017 17:37:24 -0700 Subject: [PATCH 59/68] Adding the Asp.Net runtime package store to the SDK pkg for now, since we don't have a separate PKG for it being produced. --- build/package/Installer.PKG.targets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/package/Installer.PKG.targets b/build/package/Installer.PKG.targets index a4ad4600f..c109b756f 100644 --- a/build/package/Installer.PKG.targets +++ b/build/package/Installer.PKG.targets @@ -80,6 +80,14 @@ DependsOnTargets="Init;Layout;SetupPkgInputsOutputs" Condition=" '$(OSName)' == 'osx' "> + + + + + + + '$(LayoutPackageRootDir)/%(RecursiveDir)%(Filename)%(Extension)')" - SourceFiles="@(AspNetRuntimeFiles)" + DestinationFiles="@(AspNetRuntimeFilesInput ->'$(LayoutPackageRootDir)/%(RecursiveDir)%(Filename)%(Extension)')" + SourceFiles="@(AspNetRuntimeFilesInput)" OverwriteReadOnlyFiles="True" SkipUnchangedFiles="False" UseHardlinksIfPossible="False" /> diff --git a/build/package/Installer.DEB.targets b/build/package/Installer.DEB.targets index 20be6d3b3..c4f0d1797 100644 --- a/build/package/Installer.DEB.targets +++ b/build/package/Installer.DEB.targets @@ -42,11 +42,9 @@ $(RepoRoot)/Documentation/manpages $(RepoRoot)/test/EndToEnd/EndToEnd.csproj $(OutputDirectory)/sdk - $(AspNetRuntimePackageStorePublishDirectory) - diff --git a/build/package/Installer.PKG.targets b/build/package/Installer.PKG.targets index c109b756f..53a794905 100644 --- a/build/package/Installer.PKG.targets +++ b/build/package/Installer.PKG.targets @@ -80,13 +80,8 @@ DependsOnTargets="Init;Layout;SetupPkgInputsOutputs" Condition=" '$(OSName)' == 'osx' "> - - - - - - + + + Date: Wed, 3 May 2017 21:02:21 -0700 Subject: [PATCH 61/68] Updating the SDK to include the implicit package downgrade warnings fix. --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 0b1622065..ae7cd07f6 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.0.0-preview1-002106-00 15.3.0-preview-000117-01 2.0.0-rc4-61325-08 - 2.0.0-alpha-20170502-2 + 2.0.0-alpha-20170504-1 4.3.0-beta1-2418 1.0.0-rel-20170501-473 15.3.0-preview-20170502-03 From 6b864cfead291ca045125edd812c00aef7ff498f Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Wed, 3 May 2017 21:44:39 -0700 Subject: [PATCH 62/68] Update to ASP.NET 24840 packages/Archive 65, switch to timestamped cache packages, make clearly configurable --- build/DependencyVersions.props | 11 +++++++---- build/compile/LzmaArchive.targets | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 0b1622065..02963a630 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -11,13 +11,16 @@ $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) - 1.0.0-beta2-20170427-205 - 1.0.0-beta2-20170502-215 - 1.0.0-beta2-20170502-215 + 1.0.0-beta2-20170503-217 + 1.0.0-beta2-20170503-217 + 1.0.0-beta2-20170503-217 2.0.0-preview1-002106 2.0.0-preview1-002106 0.1.0-alpha-142 - 2.0.0-preview1-56 + 2.0.0-preview1-65 + + + timestamped diff --git a/build/compile/LzmaArchive.targets b/build/compile/LzmaArchive.targets index 8acf75bfc..98a23337b 100644 --- a/build/compile/LzmaArchive.targets +++ b/build/compile/LzmaArchive.targets @@ -3,7 +3,7 @@ $(SdkOutputDirectory)/nuGetPackagesArchive.lzma - nuGetPackagesArchive.notimestamp.lzma + nuGetPackagesArchive.$(AspNetCoreRuntimePackageFlavor).lzma $(IntermediateDirectory)/$(NugetPackagesArchiveName) $(AspNetCoreRuntimeInstallerBlobRootUrl)/$(NugetPackagesArchiveName) From 755a91a05eaddeb07630c7be8d756d11153c9737 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 4 May 2017 18:12:14 -0700 Subject: [PATCH 63/68] Update to SDK with fix for design time evaluation --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ae7cd07f6..e890a10f1 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.0.0-preview1-002106-00 15.3.0-preview-000117-01 2.0.0-rc4-61325-08 - 2.0.0-alpha-20170504-1 + 2.0.0-alpha-20170505-1 4.3.0-beta1-2418 1.0.0-rel-20170501-473 15.3.0-preview-20170502-03 From d075a8ec6e128a976e6fc1f0554ff38c234fe58a Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Fri, 5 May 2017 02:49:39 +0000 Subject: [PATCH 64/68] Update CoreSetup to preview1-002111 --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 43e7dadfa..5ef06e7cf 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.0.0-preview1-002106-00 + 2.0.0-preview1-002111-00 15.3.0-preview-000117-01 2.0.0-rc4-61325-08 2.0.0-alpha-20170505-1 @@ -14,8 +14,8 @@ 1.0.0-beta2-20170503-217 1.0.0-beta2-20170503-217 1.0.0-beta2-20170503-217 - 2.0.0-preview1-002106 - 2.0.0-preview1-002106 + 2.0.0-preview1-002111 + 2.0.0-preview1-002111 0.1.0-alpha-142 2.0.0-preview1-65 From 17f522e66ce52d76d2746db518e31b1bfa7d35ca Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Thu, 4 May 2017 19:22:05 -0700 Subject: [PATCH 65/68] Update to no-timestamp packages and adjust feeds and cache accordingly --- NuGet.Config | 4 ++-- build/DependencyVersions.props | 6 +++--- test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config | 5 +++-- test/dotnet-new.Tests/NuGet.tempaspnetpatch.config | 5 +++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 4d79bc8e0..120a5daf6 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -5,13 +5,13 @@ - + + - diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 5ef06e7cf..94c178b8d 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -12,15 +12,15 @@ $(CLI_SharedFrameworkVersion) $(CLI_SharedFrameworkVersion) 1.0.0-beta2-20170503-217 - 1.0.0-beta2-20170503-217 - 1.0.0-beta2-20170503-217 + 1.0.0-beta2-20170504-221 + 1.0.0-beta2-20170504-221 2.0.0-preview1-002111 2.0.0-preview1-002111 0.1.0-alpha-142 2.0.0-preview1-65 - timestamped + notimestamp diff --git a/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config b/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config index 1f41d2665..33b9693d5 100644 --- a/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config +++ b/test/dotnet-migrate.Tests/NuGet.tempaspnetpatch.config @@ -4,7 +4,8 @@ - - + + + \ No newline at end of file diff --git a/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config b/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config index 1f41d2665..33b9693d5 100644 --- a/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config +++ b/test/dotnet-new.Tests/NuGet.tempaspnetpatch.config @@ -4,7 +4,8 @@ - - + + + \ No newline at end of file From 209d05992fb0cec455c37734f48386a05bd3dc71 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Thu, 4 May 2017 22:46:23 -0700 Subject: [PATCH 66/68] Disable telemetry for new --- src/dotnet/commands/dotnet-new/NewCommandShim.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dotnet/commands/dotnet-new/NewCommandShim.cs b/src/dotnet/commands/dotnet-new/NewCommandShim.cs index bc06185cc..6e36fd9c0 100644 --- a/src/dotnet/commands/dotnet-new/NewCommandShim.cs +++ b/src/dotnet/commands/dotnet-new/NewCommandShim.cs @@ -29,13 +29,14 @@ namespace Microsoft.DotNet.Tools.New { var sessionId = Environment.GetEnvironmentVariable(MSBuildForwardingApp.TelemetrySessionIdEnvironmentVariableName); var telemetry = new Telemetry(new NuGetCacheSentinel(new CliFallbackFolderPathCalculator()), sessionId); - var logger = new TelemetryLogger((name, props, measures) => - { - if (telemetry.Enabled) - { - telemetry.TrackEvent(name, props, measures); - } - }); + var logger = new TelemetryLogger(null); + //(name, props, measures) => + //{ + // if (telemetry.Enabled) + // { + // telemetry.TrackEvent(name, props, measures); + // } + //}); return New3Command.Run(CommandName, CreateHost(), logger, FirstRun, args); } From 8b13b3e5797dbe37444f99991100da0eb5c1b7a6 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 5 May 2017 13:13:18 -0700 Subject: [PATCH 67/68] Fall back to tools restored for .NET Core 1.x if they haven't been restored for .NET Core 2.0 --- .../ProjectToolsCommandResolver.cs | 26 ++++++++- test/dotnet.Tests/PackagedCommandTests.cs | 55 ++++++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index 7cd9a6113..8f952c950 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -141,9 +141,33 @@ namespace Microsoft.DotNet.Cli.Utils toolPackageFramework, possiblePackageRoots); + + // NuGet restore in Visual Studio may restore for netcoreapp1.0. So if that happens, fall back to + // looking for a netcoreapp1.0 or netcoreapp1.1 tool restore. if (toolLockFile == null) { - return null; + if (toolPackageFramework.Framework == FrameworkConstants.FrameworkIdentifiers.NetCoreApp && + toolPackageFramework.Version >= new Version(2, 0, 0)) + { + foreach (var fallbackFramework in new [] { "netcoreapp1.1", "netcoreapp1.0"}) + { + toolPackageFramework = NuGetFramework.Parse(fallbackFramework); + toolLockFile = GetToolLockFile( + toolLibraryRange, + toolPackageFramework, + possiblePackageRoots); + + if (toolLockFile != null) + { + break; + } + } + } + + if (toolLockFile == null) + { + return null; + } } Reporter.Verbose.WriteLine(string.Format( diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index bb75131d5..d5c83d97a 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -16,6 +16,7 @@ using Xunit.Abstractions; using Microsoft.Build.Construction; using System.Linq; using Microsoft.Build.Evaluation; +using System.Xml.Linq; namespace Microsoft.DotNet.Tests { @@ -161,10 +162,62 @@ namespace Microsoft.DotNet.Tests .Execute(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1"); result.Should().Pass() - .And.HaveStdOutContaining("I'm running on shared framework version 1.1.1!"); + .And.HaveStdOutContaining("I'm running on shared framework version 1.1.1!"); } + [RequiresSpecificFrameworkFact("netcoreapp1.1")] + public void IfAToolHasNotBeenRestoredForNetCoreApp2_0ItFallsBackToNetCoreApp1_x() + { + string toolName = "dotnet-portable-v1"; + + var toolFolder = Path.Combine(new RepoDirectoriesProvider().NugetPackages, + ".tools", + toolName); + + // Other tests may have restored the tool for netcoreapp2.0, so delete its tools folder + if (Directory.Exists(toolFolder)) + { + Directory.Delete(toolFolder, true); + } + + var testInstance = TestAssets.Get("AppWithToolDependency") + .CreateInstance() + .WithSourceFiles() + .WithNuGetConfig(new RepoDirectoriesProvider().TestPackages); + + testInstance = testInstance.WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + + // Remove reference to tool that won't restore on 1.x + project.Descendants(ns + "DotNetCliToolReference") + .Where(tr => tr.Attribute("Include").Value == "dotnet-PreferCliRuntime") + .Remove(); + + var toolReference = project.Descendants(ns + "DotNetCliToolReference") + .Where(tr => tr.Attribute("Include").Value == "dotnet-portable") + .Single(); + + toolReference.Attribute("Include").Value = toolName; + + // Restore tools for .NET Core 1.1 + project.Root.Element(ns + "PropertyGroup") + .Add(new XElement(ns + "DotnetCliToolTargetFramework", "netcoreapp1.1")); + + }); + + testInstance = testInstance.WithRestoreFiles(); + + var result = + new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) + .WithWorkingDirectory(testInstance.Root) + .Execute("portable-v1"); + + result.Should().Pass() + .And.HaveStdOutContaining("I'm running on shared framework version 1.1.1!"); + } + [Fact] public void CanInvokeToolWhosePackageNameIsDifferentFromDllName() { From 10dd67baa8853d0a01e229f685e85f4d4f71fab1 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 5 May 2017 14:23:33 -0700 Subject: [PATCH 68/68] Clean up tool restore framework fallback logic so there aren't multiple call sites to GetToolLockFile --- .../ProjectToolsCommandResolver.cs | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index 8f952c950..a75472142 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -134,40 +134,39 @@ namespace Microsoft.DotNet.Cli.Utils ProjectToolsCommandResolverName, string.Join(Environment.NewLine, possiblePackageRoots.Select((p) => $"- {p}")))); - var toolPackageFramework = project.DotnetCliToolTargetFramework; - - var toolLockFile = GetToolLockFile( - toolLibraryRange, - toolPackageFramework, - possiblePackageRoots); - + List toolFrameworksToCheck = new List(); + toolFrameworksToCheck.Add(project.DotnetCliToolTargetFramework); // NuGet restore in Visual Studio may restore for netcoreapp1.0. So if that happens, fall back to // looking for a netcoreapp1.0 or netcoreapp1.1 tool restore. + if (project.DotnetCliToolTargetFramework.Framework == FrameworkConstants.FrameworkIdentifiers.NetCoreApp && + project.DotnetCliToolTargetFramework.Version >= new Version(2, 0, 0)) + { + toolFrameworksToCheck.Add(NuGetFramework.Parse("netcoreapp1.1")); + toolFrameworksToCheck.Add(NuGetFramework.Parse("netcoreapp1.0")); + } + + + LockFile toolLockFile = null; + NuGetFramework toolTargetFramework = null; ; + + foreach (var toolFramework in toolFrameworksToCheck) + { + toolLockFile = GetToolLockFile( + toolLibraryRange, + toolFramework, + possiblePackageRoots); + + if (toolLockFile != null) + { + toolTargetFramework = toolFramework; + break; + } + } + if (toolLockFile == null) { - if (toolPackageFramework.Framework == FrameworkConstants.FrameworkIdentifiers.NetCoreApp && - toolPackageFramework.Version >= new Version(2, 0, 0)) - { - foreach (var fallbackFramework in new [] { "netcoreapp1.1", "netcoreapp1.0"}) - { - toolPackageFramework = NuGetFramework.Parse(fallbackFramework); - toolLockFile = GetToolLockFile( - toolLibraryRange, - toolPackageFramework, - possiblePackageRoots); - - if (toolLockFile != null) - { - break; - } - } - } - - if (toolLockFile == null) - { - return null; - } + return null; } Reporter.Verbose.WriteLine(string.Format( @@ -176,7 +175,7 @@ namespace Microsoft.DotNet.Cli.Utils toolLockFile.Path)); var toolLibrary = toolLockFile.Targets - .FirstOrDefault(t => toolPackageFramework == t.TargetFramework) + .FirstOrDefault(t => toolTargetFramework == t.TargetFramework) ?.Libraries.FirstOrDefault( l => StringComparer.OrdinalIgnoreCase.Equals(l.Name, toolLibraryRange.Name)); if (toolLibrary == null) @@ -192,7 +191,7 @@ namespace Microsoft.DotNet.Cli.Utils var depsFilePath = GetToolDepsFilePath( toolLibraryRange, - toolPackageFramework, + toolTargetFramework, toolLockFile, depsFileRoot, project.ToolDepsJsonGeneratorProject);