diff --git a/Documentation/developer-guide.md b/Documentation/developer-guide.md index 27075ccd8..18cb44890 100644 --- a/Documentation/developer-guide.md +++ b/Documentation/developer-guide.md @@ -30,7 +30,7 @@ In order to build .NET Command Line Interface, you need the following installed ## Building/Running -1. Run `build.cmd` or `build.sh` from the root depending on your OS. If you don't want to execute tests, run `build.cmd -Targets Compile` or `./build.sh --targets Compile`. +1. Run `build.cmd` or `build.sh` from the root depending on your OS. If you don't want to execute tests, run `build.cmd -Targets Prepare,Compile` or `./build.sh --targets Prepare,Compile`. 2. Use `artifacts/{os}-{arch}/stage2/dotnet` to try out the `dotnet` command. You can also add `artifacts/{os}-{arch}/stage2` to the PATH if you want to run `dotnet` from anywhere. ## A simple test diff --git a/Documentation/specs/runtime-configuration-file.md b/Documentation/specs/runtime-configuration-file.md index 0acb469d3..fbf6e2c4c 100644 --- a/Documentation/specs/runtime-configuration-file.md +++ b/Documentation/specs/runtime-configuration-file.md @@ -36,7 +36,7 @@ The files are both JSON files stored in UTF-8 encoding. Below are sample files. "framework": { "name": "Microsoft.DotNetCore", "version": "1.0.1" - } + }, "applyPatches": false } diff --git a/README.md b/README.md index 77487238a..6cf4f8630 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,12 @@ This repo contains the source code for cross-platform [.NET Core](http://github.com/dotnet/core) command line toolchain. It contains the implementation of each command, the native packages for various supported platforms as well as documentation. -RC2 and Preview 1 bits +RTM and Preview 2 bits --------------------- -To get the latest released bits (RC2 for .NET Core and Preview for tooling), +To get the latest released bits (RTM for .NET Core and Preview 2 for tooling), check out our [Getting started page](http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409). -Also, don't forget to check out [the documentation](http://dotnet.github.io/docs/core-concepts/core-sdk/index.html). - -Release schedule ----------------- - -There have been some changes in the schedule for .NET Core and .NET Core CLI tools. You can read more about them in the [.NET Core RC2 Improvements, Schedule, and Roadmap](https://blogs.msdn.microsoft.com/dotnet/2016/05/06/net-core-rc2-improvements-schedule-and-roadmap/) blog post. +Also, don't forget to check out [the documentation](https://aka.ms/dotnet-cli-docs). Found an issue? --------------- @@ -41,7 +36,7 @@ You can download .NET Core as either an installer (MSI, PKG) or a zip (zip, gzip - .NET Core SDK - .NET Core + CLI tools > **Note:** please be aware that below installers are the **latest bits**. If you -> want to install the latest released versions, please check out the [section above](#rc2-and-preview-1-bits).) +> want to install the latest released versions, please check out the [section above](#rtm-and-preview-2-bits).) | |Version |.NET Core Installer|.NET Core SDK Installer|.NET Core Binaries|.NET Core SDK Binaries| |---------|:------:|:------:|:------:|:------:|:------:| @@ -98,7 +93,7 @@ Compiling to IL is done using: This will drop an IL assembly in `./bin/[configuration]/[framework]/[binary name]` that you can run using `dotnet bin/[configuration]/[framework]/[binaryname.dll]`. -For more details, please refer to the [documentation](http://dotnet.github.io/docs/core-concepts/core-sdk/index.html). +For more details, please refer to the [documentation](https://aka.ms/dotnet-cli-docs). Building from source -------------------- @@ -115,5 +110,5 @@ For any and all feedback, please use the Issues on this repository. License -------------------- -By downloading the .zip you are agreeing to the terms in the project [EULA](https://aka.ms/dotnet-cli-eula). +By downloading the .zip you are agreeing to the terms in the project [EULA](https://aka.ms/dotnet-core-eula). diff --git a/TestAssets/TestProjects/EndToEndTestApp/project.json b/TestAssets/TestProjects/EndToEndTestApp/project.json index a83d47689..10ae17942 100644 --- a/TestAssets/TestProjects/EndToEndTestApp/project.json +++ b/TestAssets/TestProjects/EndToEndTestApp/project.json @@ -20,11 +20,12 @@ "files": { "includeFiles": "packfiles/pack1.txt", "mappings": { - "newpath/": "packfiles/pack2.txt" + "newpath/": "packfiles/pack2.txt", + "anotherpath/": "packfiles/pack2.txt" } } }, - "publishOptions": "testpublishfile.txt", + "publishOptions": [ "testpublishfile.txt", "publishfiles" ], "frameworks": { "netcoreapp1.0": {} }, diff --git a/TestAssets/TestProjects/EndToEndTestApp/publishfiles/anotherpublishfile.txt b/TestAssets/TestProjects/EndToEndTestApp/publishfiles/anotherpublishfile.txt new file mode 100644 index 000000000..e69de29bb diff --git a/build.cmd b/build.cmd index cbf5108a7..013687943 100644 --- a/build.cmd +++ b/build.cmd @@ -3,5 +3,5 @@ REM Copyright (c) .NET Foundation and contributors. All rights reserved. REM Licensed under the MIT license. See LICENSE file in the project root for full license information. -powershell -NoProfile -NoLogo -Command "%~dp0run-build.ps1 %*; exit $LastExitCode;" +powershell -NoProfile -NoLogo -Command "& \"%~dp0run-build.ps1\" %*; exit $LastExitCode;" if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/build_projects/Microsoft.DotNet.Cli.Build.Framework/BuildSetup.cs b/build_projects/Microsoft.DotNet.Cli.Build.Framework/BuildSetup.cs index eedd6d562..2bb42aa47 100644 --- a/build_projects/Microsoft.DotNet.Cli.Build.Framework/BuildSetup.cs +++ b/build_projects/Microsoft.DotNet.Cli.Build.Framework/BuildSetup.cs @@ -69,7 +69,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework { foreach (var targetOverride in _overrides) { - Reporter.Verbose.WriteLine($"Target {targetOverride.Name} from {targetOverride.OriginalSource} was overridden in {targetOverride.OverrideSource}".Black()); + Reporter.Verbose.WriteLine($"Target {targetOverride.Name} from {targetOverride.OriginalSource} was overridden in {targetOverride.OverrideSource}"); } } diff --git a/build_projects/update-dependencies/BuildContextProperties.cs b/build_projects/update-dependencies/BuildContextProperties.cs deleted file mode 100644 index 6cd488398..000000000 --- a/build_projects/update-dependencies/BuildContextProperties.cs +++ /dev/null @@ -1,30 +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.Collections.Generic; -using Microsoft.DotNet.Cli.Build.Framework; - -namespace Microsoft.DotNet.Scripts -{ - public static class BuildContextProperties - { - public static List GetDependencyInfos(this BuildTargetContext c) - { - const string propertyName = "DependencyInfos"; - - List dependencyInfos; - object dependencyInfosObj; - if (c.BuildContext.Properties.TryGetValue(propertyName, out dependencyInfosObj)) - { - dependencyInfos = (List)dependencyInfosObj; - } - else - { - dependencyInfos = new List(); - c.BuildContext[propertyName] = dependencyInfos; - } - - return dependencyInfos; - } - } -} diff --git a/build_projects/update-dependencies/Config.cs b/build_projects/update-dependencies/Config.cs index 1221d2d00..c88680802 100644 --- a/build_projects/update-dependencies/Config.cs +++ b/build_projects/update-dependencies/Config.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using Microsoft.DotNet.Cli.Build.Framework; namespace Microsoft.DotNet.Scripts { @@ -18,10 +17,10 @@ namespace Microsoft.DotNet.Scripts /// /// The following Environment Variables can optionally be specified: /// - /// COREFX_VERSION_URL - The Url to get the current CoreFx package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0/Latest_Packages.txt") - /// CORECLR_VERSION_URL - The Url to get the current CoreCLR version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0/Latest_Packages.txt") - /// ROSLYN_VERSION_URL - The Url to get the current Roslyn version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0/Latest_Packages.txt") - /// CORESETUP_VERSION_URL - The Url to get the current dotnet/core-setup package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0/Latest_Packages.txt") + /// COREFX_VERSION_URL - The Url to get the current CoreFx package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0") + /// CORECLR_VERSION_URL - The Url to get the current CoreCLR version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0") + /// ROSLYN_VERSION_URL - The Url to get the current Roslyn version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0") + /// CORESETUP_VERSION_URL - The Url to get the current dotnet/core-setup package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0") /// GITHUB_ORIGIN_OWNER - The owner of the GitHub fork to push the commit and create the PR from. (ex. "dotnet-bot") /// GITHUB_UPSTREAM_OWNER - The owner of the GitHub base repo to create the PR to. (ex. "dotnet") /// GITHUB_PROJECT - The repo name under the ORIGIN and UPSTREAM owners. (ex. "cli") @@ -36,11 +35,10 @@ namespace Microsoft.DotNet.Scripts private Lazy _email = new Lazy(() => GetEnvironmentVariable("GITHUB_EMAIL")); private Lazy _password = new Lazy(() => GetEnvironmentVariable("GITHUB_PASSWORD")); - private Lazy _coreFxVersionUrl = new Lazy(() => GetEnvironmentVariable("COREFX_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0/Latest_Packages.txt")); - private Lazy _coreClrVersionUrl = new Lazy(() => GetEnvironmentVariable("CORECLR_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0/Latest_Packages.txt")); - private Lazy _roslynVersionUrl = new Lazy(() => GetEnvironmentVariable("ROSLYN_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0/Latest_Packages.txt")); - private Lazy _coreSetupVersionUrl = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0/Latest_Packages.txt")); - private Lazy _gitHubOriginOwner; + private Lazy _coreFxVersionUrl = new Lazy(() => GetEnvironmentVariable("COREFX_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0")); + private Lazy _coreClrVersionUrl = new Lazy(() => GetEnvironmentVariable("CORECLR_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0")); + private Lazy _roslynVersionUrl = new Lazy(() => GetEnvironmentVariable("ROSLYN_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0")); + private Lazy _coreSetupVersionUrl = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0")); 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", "rel/1.0.0")); @@ -50,7 +48,6 @@ namespace Microsoft.DotNet.Scripts private Config() { - _gitHubOriginOwner = new Lazy(() => GetEnvironmentVariable("GITHUB_ORIGIN_OWNER", UserName)); } public string UserName => _userName.Value; @@ -60,7 +57,6 @@ namespace Microsoft.DotNet.Scripts public string CoreClrVersionUrl => _coreClrVersionUrl.Value; public string RoslynVersionUrl => _roslynVersionUrl.Value; public string CoreSetupVersionUrl => _coreSetupVersionUrl.Value; - public string GitHubOriginOwner => _gitHubOriginOwner.Value; public string GitHubUpstreamOwner => _gitHubUpstreamOwner.Value; public string GitHubProject => _gitHubProject.Value; public string GitHubUpstreamBranch => _gitHubUpstreamBranch.Value; @@ -76,7 +72,7 @@ namespace Microsoft.DotNet.Scripts if (value == null) { - throw new BuildFailureException($"Can't find environment variable '{name}'."); + throw new InvalidOperationException($"Can't find environment variable '{name}'."); } return value; diff --git a/build_projects/update-dependencies/DependencyInfo.cs b/build_projects/update-dependencies/DependencyInfo.cs deleted file mode 100644 index 48b4d8f8e..000000000 --- a/build_projects/update-dependencies/DependencyInfo.cs +++ /dev/null @@ -1,23 +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.Collections.Generic; -using NuGet.Versioning; - -namespace Microsoft.DotNet.Scripts -{ - public class DependencyInfo - { - public string Name { get; set; } - public List NewVersions { get; set; } - public string NewReleaseVersion { get; set; } - - public bool IsUpdated { get; set; } - } - - public class PackageInfo - { - public string Id { get; set; } - public NuGetVersion Version { get; set; } - } -} diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index f0fc8f8d1..62dcd0ed5 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -1,25 +1,97 @@ // 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.Build.Framework; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.VersionTools; +using Microsoft.DotNet.VersionTools.Automation; +using Microsoft.DotNet.VersionTools.Dependencies; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; namespace Microsoft.DotNet.Scripts { public class Program { - public static int Main(string[] args) + private static readonly Config s_config = Config.Instance; + + public static void Main(string[] args) { DebugHelper.HandleDebugSwitch(ref args); - return BuildSetup.Create(".NET CLI Dependency Updater") - .UseTargets(new[] - { - new BuildTarget("Default", "Dependency Updater Goals", new [] { "UpdateFiles", "PushPR" }), - new BuildTarget("UpdateFiles", "Dependency Updater Goals"), - new BuildTarget("PushPR", "Dependency Updater Goals"), - }) - .UseAllTargetsFromAssembly() - .Run(args); + List buildInfos = new List(); + + buildInfos.Add(BuildInfo.Get("CoreFx", s_config.CoreFxVersionUrl, fetchLatestReleaseFile: false)); + buildInfos.Add(BuildInfo.Get("CoreClr", s_config.CoreClrVersionUrl, fetchLatestReleaseFile: false)); + buildInfos.Add(BuildInfo.Get("Roslyn", s_config.RoslynVersionUrl, fetchLatestReleaseFile: false)); + buildInfos.Add(BuildInfo.Get("CoreSetup", s_config.CoreSetupVersionUrl, fetchLatestReleaseFile: false)); + + IEnumerable updaters = GetUpdaters(); + + GitHubAuth gitHubAuth = new GitHubAuth(s_config.Password, s_config.UserName, s_config.Email); + + DependencyUpdater dependencyUpdater = new DependencyUpdater( + gitHubAuth, + s_config.GitHubProject, + s_config.GitHubUpstreamOwner, + s_config.GitHubUpstreamBranch, + s_config.UserName, + s_config.GitHubPullRequestNotifications); + + if (args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase)) + { + dependencyUpdater.Update(updaters, buildInfos); + } + else + { + dependencyUpdater.UpdateAndSubmitPullRequestAsync(updaters, buildInfos); + } + } + + private static IEnumerable GetUpdaters() + { + yield return CreateProjectJsonUpdater(); + + yield return CreateRegexUpdater(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", "CoreCLRVersion", "Microsoft.NETCore.Runtime.CoreCLR"); + yield return CreateRegexUpdater(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", "JitVersion", "Microsoft.NETCore.Jit"); + + yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "SharedFrameworkVersion", "Microsoft.NETCore.App"); + yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "HostFxrVersion", "Microsoft.NETCore.DotNetHostResolver"); + yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "SharedHostVersion", "Microsoft.NETCore.DotNetHost"); + } + + private static IDependencyUpdater CreateProjectJsonUpdater() + { + IEnumerable projectJsonFiles = GetProjectJsonsToUpdate(); + + return new ProjectJsonUpdater(projectJsonFiles) + { + SkipStableVersions = false + }; + } + + private static IEnumerable GetProjectJsonsToUpdate() + { + const string noUpdateFileName = ".noautoupdate"; + + return Enumerable.Union( + Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), + Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)) + .Where(p => !File.Exists(Path.Combine(Path.GetDirectoryName(p), noUpdateFileName)) && + !Path.GetDirectoryName(p).EndsWith("CSharp_Web", StringComparison.Ordinal)); + } + + private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, string dependencyPropertyName, string packageId) + { + return new FileRegexPackageUpdater() + { + Path = Path.Combine(Dirs.RepoRoot, repoRelativePath), + PackageId = packageId, + Regex = new Regex($@"{dependencyPropertyName} = ""(?.*)"";"), + VersionGroupName = "version" + }; } } } diff --git a/build_projects/update-dependencies/PushPRTargets.cs b/build_projects/update-dependencies/PushPRTargets.cs deleted file mode 100644 index 2d989a79e..000000000 --- a/build_projects/update-dependencies/PushPRTargets.cs +++ /dev/null @@ -1,162 +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.Linq; -using Microsoft.DotNet.Cli.Build.Framework; -using Octokit; - -using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; - -namespace Microsoft.DotNet.Scripts -{ - /// - /// Creates a GitHub Pull Request for the current changes in the repo. - /// - public static class PushPRTargets - { - private static readonly Config s_config = Config.Instance; - - [Target(nameof(CommitChanges), nameof(CreatePR))] - public static BuildTargetResult PushPR(BuildTargetContext c) => c.Success(); - - /// - /// Commits all the current changes in the repo and pushes the commit to a remote - /// so a PR can be created for it. - /// - [Target] - public static BuildTargetResult CommitChanges(BuildTargetContext c) - { - CommandResult statusResult = Cmd("git", "status", "--porcelain") - .CaptureStdOut() - .Execute(); - statusResult.EnsureSuccessful(); - - bool hasModifiedFiles = !string.IsNullOrWhiteSpace(statusResult.StdOut); - bool hasUpdatedDependencies = c.GetDependencyInfos().Where(d => d.IsUpdated).Any(); - - if (hasModifiedFiles != hasUpdatedDependencies) - { - return c.Failed($"'git status' does not match DependencyInfo information. Git has modified files: {hasModifiedFiles}. DependencyInfo is updated: {hasUpdatedDependencies}."); - } - - if (!hasUpdatedDependencies) - { - c.Warn("Dependencies are currently up to date"); - return c.Success(); - } - - string userName = s_config.UserName; - string email = s_config.Email; - - string commitMessage = GetCommitMessage(c); - - Cmd("git", "commit", "-a", "-m", commitMessage, "--author", $"{userName} <{email}>") - .EnvironmentVariable("GIT_COMMITTER_NAME", userName) - .EnvironmentVariable("GIT_COMMITTER_EMAIL", email) - .Execute() - .EnsureSuccessful(); - - string remoteUrl = $"github.com/{s_config.GitHubOriginOwner}/{s_config.GitHubProject}.git"; - string remoteBranchName = $"UpdateDependencies{DateTime.UtcNow.ToString("yyyyMMddhhmmss")}"; - string refSpec = $"HEAD:refs/heads/{remoteBranchName}"; - - string logMessage = $"git push https://{remoteUrl} {refSpec}"; - BuildReporter.BeginSection("EXEC", logMessage); - - CommandResult pushResult = - Cmd("git", "push", $"https://{userName}:{s_config.Password}@{remoteUrl}", refSpec) - .QuietBuildReporter() // we don't want secrets showing up in our logs - .CaptureStdErr() // git push will write to StdErr upon success, disable that - .CaptureStdOut() - .Execute(); - - var message = logMessage + $" exited with {pushResult.ExitCode}"; - if (pushResult.ExitCode == 0) - { - BuildReporter.EndSection("EXEC", message.Green(), success: true); - } - else - { - BuildReporter.EndSection("EXEC", message.Red().Bold(), success: false); - } - - pushResult.EnsureSuccessful(suppressOutput: true); - - c.SetRemoteBranchName(remoteBranchName); - - return c.Success(); - } - - /// - /// Creates a GitHub PR for the remote branch created above. - /// - [Target] - public static BuildTargetResult CreatePR(BuildTargetContext c) - { - string remoteBranchName = c.GetRemoteBranchName(); - string commitMessage = c.GetCommitMessage(); - - NewPullRequest prInfo = new NewPullRequest( - commitMessage, - s_config.GitHubOriginOwner + ":" + remoteBranchName, - s_config.GitHubUpstreamBranch); - - string[] prNotifications = s_config.GitHubPullRequestNotifications; - if (prNotifications.Length > 0) - { - prInfo.Body = $"/cc @{string.Join(" @", prNotifications)}"; - } - - GitHubClient gitHub = new GitHubClient(new ProductHeaderValue("dotnetDependencyUpdater")); - - gitHub.Credentials = new Credentials(s_config.Password); - - PullRequest createdPR = gitHub.PullRequest.Create(s_config.GitHubUpstreamOwner, s_config.GitHubProject, prInfo).Result; - c.Info($"Created Pull Request: {createdPR.HtmlUrl}"); - - return c.Success(); - } - - private static string GetRemoteBranchName(this BuildTargetContext c) - { - return (string)c.BuildContext["RemoteBranchName"]; - } - - private static void SetRemoteBranchName(this BuildTargetContext c, string value) - { - c.BuildContext["RemoteBranchName"] = value; - } - - private static string GetCommitMessage(this BuildTargetContext c) - { - const string commitMessagePropertyName = "CommitMessage"; - - string message; - object messageObject; - if (c.BuildContext.Properties.TryGetValue(commitMessagePropertyName, out messageObject)) - { - message = (string)messageObject; - } - else - { - DependencyInfo[] updatedDependencies = c.GetDependencyInfos() - .Where(d => d.IsUpdated) - .ToArray(); - - string updatedDependencyNames = string.Join(", ", updatedDependencies.Select(d => d.Name)); - string updatedDependencyVersions = string.Join(", ", updatedDependencies.Select(d => d.NewReleaseVersion)); - - message = $"Updating {updatedDependencyNames} to {updatedDependencyVersions}"; - if (updatedDependencies.Count() > 1) - { - message += " respectively"; - } - - c.BuildContext[commitMessagePropertyName] = message; - } - - return message; - } - } -} diff --git a/build_projects/update-dependencies/UpdateFilesTargets.cs b/build_projects/update-dependencies/UpdateFilesTargets.cs deleted file mode 100644 index 9a0c3053c..000000000 --- a/build_projects/update-dependencies/UpdateFilesTargets.cs +++ /dev/null @@ -1,283 +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.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Microsoft.DotNet.Cli.Build.Framework; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using NuGet.Versioning; - -namespace Microsoft.DotNet.Scripts -{ - public static class UpdateFilesTargets - { - private static HttpClient s_client = new HttpClient(); - - [Target(nameof(GetDependencies), nameof(ReplaceVersions))] - public static BuildTargetResult UpdateFiles(BuildTargetContext c) => c.Success(); - - /// - /// Gets all the dependency information and puts it in the build properties. - /// - [Target] - public static BuildTargetResult GetDependencies(BuildTargetContext c) - { - List dependencyInfos = c.GetDependencyInfos(); - - dependencyInfos.Add(CreateDependencyInfo("CoreFx", Config.Instance.CoreFxVersionUrl).Result); - dependencyInfos.Add(CreateDependencyInfo("CoreClr", Config.Instance.CoreClrVersionUrl).Result); - dependencyInfos.Add(CreateDependencyInfo("Roslyn", Config.Instance.RoslynVersionUrl).Result); - dependencyInfos.Add(CreateDependencyInfo("CoreSetup", Config.Instance.CoreSetupVersionUrl).Result); - - return c.Success(); - } - - private static async Task CreateDependencyInfo(string name, string packageVersionsUrl) - { - List newPackageVersions = new List(); - - using (Stream versionsStream = await s_client.GetStreamAsync(packageVersionsUrl)) - using (StreamReader reader = new StreamReader(versionsStream)) - { - string currentLine; - while ((currentLine = await reader.ReadLineAsync()) != null) - { - int spaceIndex = currentLine.IndexOf(' '); - - newPackageVersions.Add(new PackageInfo() - { - Id = currentLine.Substring(0, spaceIndex), - Version = new NuGetVersion(currentLine.Substring(spaceIndex + 1)) - }); - } - } - - string newReleaseVersion = newPackageVersions - .Where(p => p.Version.IsPrerelease) - .Select(p => p.Version.Release) - .FirstOrDefault() - ?? - // if there are no prerelease versions, just grab the first version - newPackageVersions - .Select(p => p.Version.ToNormalizedString()) - .FirstOrDefault(); - - return new DependencyInfo() - { - Name = name, - NewVersions = newPackageVersions, - NewReleaseVersion = newReleaseVersion - }; - } - - [Target(nameof(ReplaceProjectJson), nameof(ReplaceDependencyVersions))] - public static BuildTargetResult ReplaceVersions(BuildTargetContext c) => c.Success(); - - /// - /// Replaces all the dependency versions in the project.json files. - /// - [Target] - public static BuildTargetResult ReplaceProjectJson(BuildTargetContext c) - { - List dependencyInfos = c.GetDependencyInfos(); - - const string noUpdateFileName = ".noautoupdate"; - - IEnumerable projectJsonFiles = Enumerable.Union( - Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), - Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)) - .Where(p => !File.Exists(Path.Combine(Path.GetDirectoryName(p), noUpdateFileName)) && - !Path.GetDirectoryName(p).EndsWith("CSharp_Web", StringComparison.Ordinal)); - - JObject projectRoot; - foreach (string projectJsonFile in projectJsonFiles) - { - try - { - projectRoot = ReadProject(projectJsonFile); - } - catch (Exception e) - { - c.Warn($"Non-fatal exception occurred reading '{projectJsonFile}'. Skipping file. Exception: {e}. "); - continue; - } - - if (projectRoot == null) - { - c.Warn($"A non valid JSON file was encountered '{projectJsonFile}'. Skipping file."); - continue; - } - - bool changedAnyPackage = FindAllDependencyProperties(projectRoot) - .Select(dependencyProperty => ReplaceDependencyVersion(dependencyProperty, dependencyInfos)) - .ToArray() - .Any(shouldWrite => shouldWrite); - - if (changedAnyPackage) - { - c.Info($"Writing changes to {projectJsonFile}"); - WriteProject(projectRoot, projectJsonFile); - } - } - - return c.Success(); - } - - /// - /// Replaces the single dependency with the updated version, if it matches any of the dependencies that need to be updated. - /// - private static bool ReplaceDependencyVersion(JProperty dependencyProperty, List dependencyInfos) - { - string id = dependencyProperty.Name; - foreach (DependencyInfo dependencyInfo in dependencyInfos) - { - foreach (PackageInfo packageInfo in dependencyInfo.NewVersions) - { - if (id == packageInfo.Id) - { - string oldVersion; - if (dependencyProperty.Value is JObject) - { - oldVersion = (string)dependencyProperty.Value["version"]; - } - else - { - oldVersion = (string)dependencyProperty.Value; - } - - string newVersion = packageInfo.Version.ToNormalizedString(); - if (oldVersion != newVersion) - { - if (dependencyProperty.Value is JObject) - { - dependencyProperty.Value["version"] = newVersion; - } - else - { - dependencyProperty.Value = newVersion; - } - - // mark the DependencyInfo as updated so we can tell which dependencies were updated - dependencyInfo.IsUpdated = true; - - return true; - } - } - } - } - - return false; - } - - private static JObject ReadProject(string projectJsonPath) - { - using (TextReader projectFileReader = File.OpenText(projectJsonPath)) - { - var projectJsonReader = new JsonTextReader(projectFileReader); - - var serializer = new JsonSerializer(); - return serializer.Deserialize(projectJsonReader); - } - } - - private static void WriteProject(JObject projectRoot, string projectJsonPath) - { - string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented); - - File.WriteAllText(projectJsonPath, projectJson + Environment.NewLine); - } - - private static IEnumerable FindAllDependencyProperties(JObject projectJsonRoot) - { - return projectJsonRoot - .Descendants() - .OfType() - .Where(property => property.Name == "dependencies") - .Select(property => property.Value) - .SelectMany(o => o.Children()); - } - - /// - /// Replaces version numbers that are hard-coded in DependencyVersions.cs and CliDependencyVersions.cs. - /// - [Target] - public static BuildTargetResult ReplaceDependencyVersions(BuildTargetContext c) - { - ReplaceFileContents(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", fileContents => - { - fileContents = ReplaceDependencyVersion(c, fileContents, "CoreCLRVersion", "Microsoft.NETCore.Runtime.CoreCLR"); - fileContents = ReplaceDependencyVersion(c, fileContents, "JitVersion", "Microsoft.NETCore.Jit"); - - return fileContents; - }); - - ReplaceFileContents(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", fileContents => - { - fileContents = ReplaceDependencyVersion(c, fileContents, "SharedFrameworkVersion", "Microsoft.NETCore.App"); - fileContents = ReplaceDependencyVersion(c, fileContents, "HostFxrVersion", "Microsoft.NETCore.DotNetHostResolver"); - fileContents = ReplaceDependencyVersion(c, fileContents, "SharedHostVersion", "Microsoft.NETCore.DotNetHost"); - - return fileContents; - }); - - return c.Success(); - } - - private static string ReplaceDependencyVersion(BuildTargetContext c, string fileContents, string dependencyPropertyName, string packageId) - { - Regex regex = new Regex($@"{dependencyPropertyName} = ""(?.*)"";"); - string newVersion = c.GetNewVersion(packageId); - - return regex.ReplaceGroupValue(fileContents, "version", newVersion); - } - - private static string GetNewVersion(this BuildTargetContext c, string packageId) - { - string newVersion = c.GetDependencyInfos() - .SelectMany(d => d.NewVersions) - .FirstOrDefault(p => p.Id == packageId) - ?.Version - .ToNormalizedString(); - - if (string.IsNullOrEmpty(newVersion)) - { - c.Error($"Could not find package version information for '{packageId}'"); - return $"DEPENDENCY '{packageId}' NOT FOUND"; - } - - return newVersion; - } - - private static void ReplaceFileContents(string repoRelativePath, Func replacement) - { - string fullPath = Path.Combine(Dirs.RepoRoot, repoRelativePath); - string contents = File.ReadAllText(fullPath); - - contents = replacement(contents); - - File.WriteAllText(fullPath, contents, Encoding.UTF8); - } - - private static string ReplaceGroupValue(this Regex regex, string input, string groupName, string newValue) - { - return regex.Replace(input, m => - { - string replacedValue = m.Value; - Group group = m.Groups[groupName]; - int startIndex = group.Index - m.Index; - - replacedValue = replacedValue.Remove(startIndex, group.Length); - replacedValue = replacedValue.Insert(startIndex, newValue); - - return replacedValue; - }); - } - } -} diff --git a/build_projects/update-dependencies/project.json b/build_projects/update-dependencies/project.json index 9c9d79edf..9ca036302 100644 --- a/build_projects/update-dependencies/project.json +++ b/build_projects/update-dependencies/project.json @@ -2,28 +2,17 @@ "version": "1.0.0-*", "description": "Updates the repos dependencies", "buildOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "compile": [ + "../../src/Microsoft.DotNet.Cli.Utils/DebugHelper.cs" + ] }, "dependencies": { - "NETStandard.Library": "1.6.0", - "Microsoft.CSharp": "4.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2", - "System.Runtime.Serialization.Primitives": "4.1.1", - "Microsoft.DotNet.Cli.Build.Framework": { - "target": "project" - }, - "NuGet.Versioning": "3.5.0-beta2-1484", - "Newtonsoft.Json": "9.0.1", - "Octokit": "0.18.0", - "Microsoft.Net.Http": "2.2.29" + "Microsoft.NETCore.App": "1.0.0", + "Microsoft.DotNet.VersionTools": "1.0.26-prerelease-00615-07" }, "frameworks": { - "netcoreapp1.0": { - "imports": [ - "dnxcore50", - "portable-net45+win" - ] - } + "netcoreapp1.0": {} }, "runtimes": { "win7-x64": {}, diff --git a/build_projects/update-dependencies/update-dependencies.ps1 b/build_projects/update-dependencies/update-dependencies.ps1 index 319f10f62..8ed440f64 100644 --- a/build_projects/update-dependencies/update-dependencies.ps1 +++ b/build_projects/update-dependencies/update-dependencies.ps1 @@ -4,15 +4,13 @@ # param( - [string[]]$Targets=@("Default"), [switch]$Help) if($Help) { - Write-Host "Usage: .\update-dependencies.ps1 [-Targets ]" + Write-Host "Usage: .\update-dependencies.ps1" Write-Host "" Write-Host "Options:" - Write-Host " -Targets Comma separated build targets to run (UpdateFiles, PushPR; Default is everything)" Write-Host " -Help Display this help message" exit 0 } @@ -36,9 +34,9 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } # Put the stage0 on the path $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" -# Restore the build_projects -Write-Host "Restoring Build projects..." -pushd "$RepoRoot\build_projects" +# Restore the app +Write-Host "Restoring update-dependencies..." +pushd "$AppPath" dotnet restore if($LASTEXITCODE -ne 0) { throw "Failed to restore" } popd @@ -51,5 +49,5 @@ if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" } # Run the app Write-Host "Invoking App $AppPath..." Write-Host " Configuration: $env:CONFIGURATION" -& "$AppPath\bin\update-dependencies.exe" @Targets +& "$AppPath\bin\update-dependencies.exe" if($LASTEXITCODE -ne 0) { throw "Build failed" } diff --git a/resources/images/version_badge.svg b/resources/images/version_badge.svg index 22c125cbd..4e4577974 100644 --- a/resources/images/version_badge.svg +++ b/resources/images/version_badge.svg @@ -1,16 +1,16 @@ - + - + - + version version - ver_number - ver_number + ver_number + ver_number - + \ No newline at end of file diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index a0ce6dc9a..71bbb89cb 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -27,16 +27,16 @@ if [ -t 1 ]; then # see if it supports colors ncolors=$(tput colors) if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then - bold="$(tput bold)" - normal="$(tput sgr0)" - black="$(tput setaf 0)" - red="$(tput setaf 1)" - green="$(tput setaf 2)" - yellow="$(tput setaf 3)" - blue="$(tput setaf 4)" - magenta="$(tput setaf 5)" - cyan="$(tput setaf 6)" - white="$(tput setaf 7)" + bold="$(tput bold || echo)" + normal="$(tput sgr0 || echo)" + black="$(tput setaf 0 || echo)" + red="$(tput setaf 1 || echo)" + green="$(tput setaf 2 || echo)" + yellow="$(tput setaf 3 || echo)" + blue="$(tput setaf 4 || echo)" + magenta="$(tput setaf 5 || echo)" + cyan="$(tput setaf 6 || echo)" + white="$(tput setaf 7 || echo)" fi fi diff --git a/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs b/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs index 7e3440c02..8c5cfc355 100644 --- a/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs +++ b/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs @@ -1,6 +1,7 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// 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.IO; using System.Linq; @@ -27,7 +28,9 @@ namespace Microsoft.DotNet.Cli.Compiler.Common foreach (var asset in assets) { - File.Copy(asset.ResolvedPath, Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath)), overwrite: true); + var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath)); + File.Copy(asset.ResolvedPath, file, overwrite: true); + RemoveFileAttribute(file, FileAttributes.ReadOnly); } } @@ -44,6 +47,19 @@ namespace Microsoft.DotNet.Cli.Compiler.Common var transformedFile = asset.GetTransformedFile(tempLocation); File.Copy(transformedFile, targetName, overwrite: true); + RemoveFileAttribute(targetName, FileAttributes.ReadOnly); + } + } + + private static void RemoveFileAttribute(String file, FileAttributes attribute) + { + if (File.Exists(file)) + { + var fileAttributes = File.GetAttributes(file); + if ((fileAttributes & attribute) == attribute) + { + File.SetAttributes(file, fileAttributes & ~attribute); + } } } diff --git a/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs b/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs index 39661bf1d..ebedcdad3 100644 --- a/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs +++ b/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs @@ -40,7 +40,8 @@ namespace Microsoft.DotNet.ProjectModel.Files var token = rawObject.Value(option); if (token.Type != JTokenType.Object) { - IncludePatterns = new List(ExtractValues(token)); + IncludePatterns = CreateCollection( + sourceBasePath, option, ExtractValues(token), literalPath: false); } else { diff --git a/src/Microsoft.DotNet.ProjectModel/Files/IncludeFilesResolver.cs b/src/Microsoft.DotNet.ProjectModel/Files/IncludeFilesResolver.cs index 15ff88670..f1baeb70f 100644 --- a/src/Microsoft.DotNet.ProjectModel/Files/IncludeFilesResolver.cs +++ b/src/Microsoft.DotNet.ProjectModel/Files/IncludeFilesResolver.cs @@ -150,7 +150,7 @@ namespace Microsoft.DotNet.ProjectModel.Files file.IsCustomTarget = true; // Prefer named targets over default ones - includeEntries.RemoveWhere(f => string.Equals(f.SourcePath, file.SourcePath)); + includeEntries.RemoveWhere(f => string.Equals(f.SourcePath, file.SourcePath) && !f.IsCustomTarget); includeEntries.Add(file); } } diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index a9508a01b..d94481b66 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -156,13 +156,10 @@ namespace Microsoft.DotNet.Cli else { CommandResult result = Command.Create("dotnet-" + command, appArgs, FrameworkConstants.CommonFrameworks.NetStandardApp15) - .ForwardStdErr() - .ForwardStdOut() .Execute(); exitCode = result.ExitCode; } - return exitCode; } diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/NuGet.Config b/src/dotnet/commands/dotnet-new/FSharp_Console/NuGet.Config deleted file mode 100644 index c9fe7428b..000000000 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/NuGet.Config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/Program.fs b/src/dotnet/commands/dotnet-new/FSharp_Console/Program.fs index 7687e612f..d5fd26e80 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/Program.fs +++ b/src/dotnet/commands/dotnet-new/FSharp_Console/Program.fs @@ -5,5 +5,4 @@ open System [] let main argv = printfn "Hello World!" - printfn "%A" argv 0 // return an integer exit code diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template index f2c366a2a..dcbeed714 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template +++ b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template @@ -1,6 +1,7 @@ { "version": "1.0.0-*", "buildOptions": { + "debugType": "portable", "emitEntryPoint": true, "compilerName": "fsc", "compile": { @@ -9,18 +10,8 @@ ] } }, - "dependencies": { - "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160509" - }, "tools": { - "dotnet-compile-fsc": { - "version": "1.0.0-preview2-*", - "imports": [ - "dnxcore50", - "portable-net45+win81", - "netstandard1.3" - ] - } + "dotnet-compile-fsc":"1.0.0-preview2-*" }, "frameworks": { "netcoreapp1.0": { @@ -28,12 +19,9 @@ "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" - } - }, - "imports": [ - "portable-net45+win8", - "dnxcore50" - ] + }, + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160629" + } } } -} +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/FSharp_Lib/Library.fs b/src/dotnet/commands/dotnet-new/FSharp_Lib/Library.fs new file mode 100644 index 000000000..ae53d091e --- /dev/null +++ b/src/dotnet/commands/dotnet-new/FSharp_Lib/Library.fs @@ -0,0 +1,5 @@ +namespace Library + +module Say = + let hello name = + printfn "Hello %s" name \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/FSharp_Lib/project.json.template b/src/dotnet/commands/dotnet-new/FSharp_Lib/project.json.template new file mode 100644 index 000000000..7e88b72f9 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/FSharp_Lib/project.json.template @@ -0,0 +1,23 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "Library.fs" + ] + } + }, + "tools": { + "dotnet-compile-fsc":"1.0.0-preview2-*" + }, + "frameworks": { + "netstandard1.6": { + "dependencies": { + "NETStandard.Library":"1.6.0", + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160629" + } + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/Program.cs b/src/dotnet/commands/dotnet-new/Program.cs index 796c51610..c840cb7ba 100644 --- a/src/dotnet/commands/dotnet-new/Program.cs +++ b/src/dotnet/commands/dotnet-new/Program.cs @@ -100,7 +100,7 @@ namespace Microsoft.DotNet.Tools.New app.HelpOption("-h|--help"); var csharp = new { Name = "C#", Alias = new[] { "c#", "cs", "csharp" }, TemplatePrefix = "CSharp", Templates = new[] { "Console", "Web", "Lib", "xunittest" } }; - var fsharp = new { Name = "F#", Alias = new[] { "f#", "fs", "fsharp" }, TemplatePrefix = "FSharp", Templates = new[] { "Console" } }; + var fsharp = new { Name = "F#", Alias = new[] { "f#", "fs", "fsharp" }, TemplatePrefix = "FSharp", Templates = new[] { "Console", "Lib" } }; var languages = new[] { csharp, fsharp }; @@ -134,7 +134,7 @@ namespace Microsoft.DotNet.Tools.New if (templateName == null) { Reporter.Error.WriteLine($"Unrecognized type: {typeValue}".Red()); - Reporter.Error.WriteLine($"Avaiable types for {language.Name} :".Red()); + Reporter.Error.WriteLine($"Available types for {language.Name} :".Red()); foreach (var t in language.Templates) { Reporter.Error.WriteLine($"- {t}".Red()); diff --git a/src/dotnet/commands/dotnet-new/README.md b/src/dotnet/commands/dotnet-new/README.md index fa1f474b0..117edacb7 100644 --- a/src/dotnet/commands/dotnet-new/README.md +++ b/src/dotnet/commands/dotnet-new/README.md @@ -22,7 +22,7 @@ After this, the project is ready to be compiled and/or edited further. `-l`, `--lang [C#|F#]` -Language of the project. Defaults to `C#`. `csharp` (`fsharp`) or `cs` (`fs`) are also valid options. +Language of the project. Defaults to `C#`. `csharp` ( or `cs` ) and `fsharp` ( or `fs` ) are also valid options. `-t`, `--type` @@ -36,20 +36,21 @@ Type of the project. Valid values for C# are: Valid values for F# are: * `console` +* `lib` ## EXAMPLES `dotnet new` - Drops a sample C## project in the current directory. + Drops a sample C# project in the current directory. -`dotnet new --lang f##` +`dotnet new --lang f#` - Drops a sample F## project in the current directory. + Drops a sample F# project in the current directory. -`dotnet new --lang c##` +`dotnet new --lang c#` - Drops a sample C## project in the current directory. + Drops a sample C# project in the current directory. # SEE ALSO dotnet-run(1) diff --git a/src/dotnet/commands/dotnet-publish/README.md b/src/dotnet/commands/dotnet-publish/README.md index 8876f2adf..c61a8cb4b 100644 --- a/src/dotnet/commands/dotnet-publish/README.md +++ b/src/dotnet/commands/dotnet-publish/README.md @@ -24,7 +24,7 @@ Depending on the type of portable app, the resulting directory will contain the dependency. 2. **Self-contained application** - same as above plus the entire runtime for the targeted platform. -The above types are covered in more details in the [types of portable applications](https://dotnet.github.io/docs/core-concepts/app-types.html) topic. +The above types are covered in more details in the [types of portable applications](https://docs.microsoft.com/en-us/dotnet/articles/core/app-types) topic. ## OPTIONS diff --git a/src/dotnet/commands/dotnet-run/README.md b/src/dotnet/commands/dotnet-run/README.md index 39ccd744b..7e6583597 100644 --- a/src/dotnet/commands/dotnet-run/README.md +++ b/src/dotnet/commands/dotnet-run/README.md @@ -30,7 +30,7 @@ The `dotnet run` command must be used in the context of projects, not built asse `dotnet myapp.dll` -For more information about the `dotnet` driver, see the [.NET Core Command Line Tools (CLI)](https://dotnet.github.io/docs/core-concepts/core-sdk/cli/overview.html) topic. +For more information about the `dotnet` driver, see the [.NET Core Command Line Tools (CLI)](https://docs.microsoft.com/en-us/dotnet/articles/core/tools/index) topic. ## OPTIONS diff --git a/src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs b/src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs index 55de7ff1b..9277afe18 100644 --- a/src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs +++ b/src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs @@ -24,8 +24,6 @@ namespace Microsoft.DotNet.Tools.Test GetCommandArgs(projectContext, dotnetTestParams), projectContext.TargetFramework, dotnetTestParams.Config) - .ForwardStdErr() - .ForwardStdOut() .Execute() .ExitCode; } diff --git a/src/dotnet/project.json b/src/dotnet/project.json index 47041df68..54a202a67 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -7,8 +7,9 @@ "commands/dotnet-new/CSharp_Console.zip", "commands/dotnet-new/CSharp_Lib.zip", "commands/dotnet-new/CSharp_xunittest.zip", + "commands/dotnet-new/CSharp_Web.zip", "commands/dotnet-new/FSharp_Console.zip", - "commands/dotnet-new/CSharp_Web.zip" + "commands/dotnet-new/FSharp_Lib.zip" ] }, "compile": { @@ -17,6 +18,7 @@ "commands/dotnet-new/FSharp_Console/**", "commands/dotnet-new/CSharp_Web/**", "commands/dotnet-new/CSharp_Lib/**", + "commands/dotnet-new/FSharp_Lib/**", "commands/dotnet-new/CSharp_xunittest/**" ] } diff --git a/test/dotnet-pack.Tests/PackTests.cs b/test/dotnet-pack.Tests/PackTests.cs index 5091e7fd7..1d9f7500a 100644 --- a/test/dotnet-pack.Tests/PackTests.cs +++ b/test/dotnet-pack.Tests/PackTests.cs @@ -113,6 +113,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read); zip.Entries.Should().Contain(e => e.FullName == "packfiles/pack1.txt"); zip.Entries.Should().Contain(e => e.FullName == "newpath/pack2.txt"); + zip.Entries.Should().Contain(e => e.FullName == "anotherpath/pack2.txt"); } [Fact] diff --git a/test/dotnet-publish.Tests/PublishTests.cs b/test/dotnet-publish.Tests/PublishTests.cs index 2246a42c9..d216b7d67 100644 --- a/test/dotnet-publish.Tests/PublishTests.cs +++ b/test/dotnet-publish.Tests/PublishTests.cs @@ -128,6 +128,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("testpublishfile.txt"); + publishCommand.GetOutputDirectory().Should().HaveFile("publishfiles/anotherpublishfile.txt"); } [Fact]