Merge rel/1.0.0-preview2 to rel/1.0.0 ()

* Update README.md

* Moving Ubuntu 16.04 to be next to Ubuntu 14.04

* Adding Oracle Linux and Linux Mint to the titles

Adding Oracle Linux and Linux Mint to the titles next to their compatible binaries.

* Remove showing firsttime eula for non verbs.

* Add Serviceable assembly attribute and nuspec attributes for all shipping CLI assemblies.

Fix 

* Use NugetCache Sentinel for Telemetry setting.

* Fix Oracle Linux version in README.md

Oracle Linux 7 -> Oracle Linux 7.1

* Fix README to use hostfxr download links ()

Also fix a rebase error from b524fd079e6dcdd744faeb6061ccbfe99d1f810f#diff-04c6e90faac2675aa89e2176d2eec7d8

* Remove the VS2012 CRT dependency from docs ()

* fix typo in dotnet-install file

This was needed to rebuild the CLI with the updated Roslyn NuGet packages.

Thanks goes to @akoken for the fix.
This commit is contained in:
Piotr Puszkiewicz 2016-06-22 15:17:54 -07:00 committed by GitHub
parent 17e6667d9f
commit 9d01e3bc2e
18 changed files with 125 additions and 64 deletions
README.md
build_projects/dotnet-cli-build
scripts/obtain
src
Microsoft.DotNet.Archive/Properties
Microsoft.DotNet.Cli.Utils/Properties
Microsoft.DotNet.Compiler.Common/Properties
Microsoft.DotNet.Configurer/Properties
Microsoft.DotNet.Files/Properties
Microsoft.DotNet.InternalAbstractions/Properties
Microsoft.DotNet.ProjectModel.Loader/Properties
Microsoft.DotNet.ProjectModel.Workspaces/Properties
Microsoft.DotNet.ProjectModel/Properties
Microsoft.DotNet.TestFramework/Properties
Microsoft.Extensions.DependencyModel/Properties
dotnet
test/dotnet.Tests

View file

@ -28,9 +28,9 @@ This project has adopted the code of conduct defined by the [Contributor Covenan
Build Status
------------
|Ubuntu 14.04 |Debian 8.2 |Windows x64 |Windows x86 |Mac OS X |CentOS 7.1 |RHEL 7.2 |
|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3132/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3132)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3271/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3271)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3022/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3022)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3071/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3071)|[![](https://devdiv.visualstudio.com/DefaultCollection/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/600/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3397)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3257/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3257)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3256/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3256)|
|Ubuntu 14.04 / Linux Mint 17 |Ubuntu 16.04 |Debian 8.2 |Windows x64 |Windows x86 |Mac OS X |CentOS 7.1 / Oracle Linux 7.1 |RHEL 7.2 |OpenSUSE 13.2 |Fedora 23|
|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3132/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3132)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3620/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3620)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3271/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3271)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3022/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3022)|[![](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3071/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3071)|[![](https://devdiv.visualstudio.com/DefaultCollection/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/600/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3397)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3257/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3257)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3256/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3256)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3625/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3625)|[![](https://mseng.visualstudio.com/_apis/public/build/definitions/d09b7a4d-0a51-4c0e-a15a-07921d5b558f/3622/badge)](https://mseng.visualstudio.com/dotnetcore/_build?_a=completed&definitionId=3622)|
Installers and Binaries
-----------------------
@ -47,11 +47,14 @@ You can download .NET Core as either an installer (MSI, PKG) or a zip (zip, gzip
|---------|:------:|:------:|:------:|:------:|:------:|
|**Windows x64**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Windows_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.win.x64.version)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-win-x64.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-dev-win-x64.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-win-x64.latest.zip)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-win-x64.latest.zip)|
|**Windows x86**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Windows_x86_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.win.x86.version)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-win-x86.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-dev-win-x86.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-win-x86.latest.zip)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-win-x86.latest.zip)|
|**Ubuntu 14.04**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Ubuntu_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.ubuntu.x64.version)|*See Below*|*See Below*|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-ubuntu-x64.latest.tar.gz)|
|**Ubuntu 14.04 / Linux Mint 17**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Ubuntu_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.ubuntu.x64.version)|*See Below*|*See Below*|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-ubuntu-x64.latest.tar.gz)|
|**Ubuntu 16.04**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Ubuntu_16_04_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.ubuntu.16.04.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-ubuntu.16.04-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-ubuntu.16.04-x64.latest.tar.gz) |
|**Debian 8.2**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Debian_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.debian.x64.version)|N/A|N/A|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-debian-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-debian-x64.latest.tar.gz)|
|**Mac OS X**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/OSX_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.osx.x64.version)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-osx-x64.latest.pkg)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-dev-osx-x64.latest.pkg)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-osx-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-osx-x64.latest.tar.gz)|
|**CentOS 7.1**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/CentOS_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.centos.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-centos-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-centos-x64.latest.tar.gz)|
|**CentOS 7.1 / Oracle Linux 7**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/CentOS_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.centos.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-centos-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-centos-x64.latest.tar.gz)|
|**RHEL 7.2**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/RHEL_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.rhel.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-rhel-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-rhel-x64.latest.tar.gz) |
|**openSUSE 13.2**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/openSUSE_13_2_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.opensuse.13.2.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-opensuse.13.2-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-opensuse.13.2-x64.latest.tar.gz) |
|**Fedora 23**|[![](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/Fedora_23_x64_Release_version_badge.svg)](https://dotnetcli.blob.core.windows.net/dotnet/preview/dnvm/latest.fedora.23.x64.version)|N/A |N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-fedora.23-x64.latest.tar.gz)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/Latest/dotnet-dev-fedora.23-x64.latest.tar.gz) |
Ubuntu Installers
----------

View file

@ -230,6 +230,7 @@ namespace Microsoft.DotNet.Cli.Build
dotnet.Pack(
projectFile,
"--no-build",
"--serviceable",
"--build-base-path", packagingBuildBasePath,
"--output", Dirs.Packages,
"--configuration", configuration,

View file

@ -668,4 +668,4 @@ else
say "Binaries of dotnet can be found in $bin_path"
fi
say "Installation finished successfuly."
say "Installation finished successfully."

View file

@ -0,0 +1,3 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -1,3 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -1,3 +1,5 @@
using System.Runtime.CompilerServices;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("dotnet-compile.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -1,3 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -0,0 +1,3 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -1,5 +1,7 @@
using System.Runtime.CompilerServices;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -0,0 +1,3 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -0,0 +1,3 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -25,4 +25,5 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("303677d5-7312-4c3f-baee-beb1a9bd9fe6")]
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ProjectModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]

View file

@ -0,0 +1,3 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -1,3 +1,5 @@
using System.Runtime.CompilerServices;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -55,11 +55,9 @@ namespace Microsoft.DotNet.Cli
try
{
ConfigureDotNetForFirstTimeUse();
using (PerfTrace.Current.CaptureTiming())
{
return ProcessArgs(args, new Telemetry());
return ProcessArgs(args);
}
}
catch (GracefulException e)
@ -78,7 +76,7 @@ namespace Microsoft.DotNet.Cli
}
}
internal static int ProcessArgs(string[] args, ITelemetry telemetryClient)
internal static int ProcessArgs(string[] args, ITelemetry telemetryClient = null)
{
// CommandLineApplication is a bit restrictive, so we parse things ourselves here. Individual apps should use CLA.
@ -86,43 +84,53 @@ namespace Microsoft.DotNet.Cli
var success = true;
var command = string.Empty;
var lastArg = 0;
for (; lastArg < args.Length; lastArg++)
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel())
{
if (IsArg(args[lastArg], "v", "verbose"))
for (; lastArg < args.Length; lastArg++)
{
verbose = true;
if (IsArg(args[lastArg], "v", "verbose"))
{
verbose = true;
}
else if (IsArg(args[lastArg], "version"))
{
PrintVersion();
return 0;
}
else if (IsArg(args[lastArg], "info"))
{
PrintInfo();
return 0;
}
else if (IsArg(args[lastArg], "h", "help"))
{
HelpCommand.PrintHelp();
return 0;
}
else if (args[lastArg].StartsWith("-"))
{
Reporter.Error.WriteLine($"Unknown option: {args[lastArg]}");
success = false;
}
else
{
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel);
// It's the command, and we're done!
command = args[lastArg];
break;
}
}
else if (IsArg(args[lastArg], "version"))
{
PrintVersion();
return 0;
}
else if (IsArg(args[lastArg], "info"))
{
PrintInfo();
return 0;
}
else if (IsArg(args[lastArg], "h", "help"))
if (!success)
{
HelpCommand.PrintHelp();
return 0;
return 1;
}
else if (args[lastArg].StartsWith("-"))
if (telemetryClient == null)
{
Reporter.Error.WriteLine($"Unknown option: {args[lastArg]}");
success = false;
telemetryClient = new Telemetry(nugetCacheSentinel);
}
else
{
// It's the command, and we're done!
command = args[lastArg];
break;
}
}
if (!success)
{
HelpCommand.PrintHelp();
return 1;
}
var appArgs = (lastArg + 1) >= args.Length ? Enumerable.Empty<string>() : args.Skip(lastArg + 1).ToArray();
@ -160,25 +168,22 @@ namespace Microsoft.DotNet.Cli
}
private static void ConfigureDotNetForFirstTimeUse()
private static void ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
{
using (PerfTrace.Current.CaptureTiming())
{
using (var nugetPackagesArchiver = new NuGetPackagesArchiver())
{
using (var nugetCacheSentinel = new NuGetCacheSentinel())
{
var environmentProvider = new EnvironmentProvider();
var commandFactory = new DotNetCommandFactory();
var nugetCachePrimer =
new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
nugetCachePrimer,
nugetCacheSentinel,
environmentProvider);
var environmentProvider = new EnvironmentProvider();
var commandFactory = new DotNetCommandFactory();
var nugetCachePrimer =
new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
nugetCachePrimer,
nugetCacheSentinel,
environmentProvider);
dotnetConfigurer.Configure();
}
dotnetConfigurer.Configure();
}
}
}

View file

@ -1,3 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("dotnet.Tests")]
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("dotnet.Tests")]

View file

@ -4,9 +4,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.InternalAbstractions;
namespace Microsoft.DotNet.Cli
@ -30,9 +32,11 @@ namespace Microsoft.DotNet.Cli
public bool Enabled { get; }
public Telemetry()
public Telemetry () : this(null) { }
public Telemetry(INuGetCacheSentinel sentinel)
{
Enabled = !Env.GetEnvironmentVariableAsBool(TelemetryOptout);
Enabled = !Env.GetEnvironmentVariableAsBool(TelemetryOptout) && PermissionExists(sentinel);
if (!Enabled)
{
@ -43,6 +47,16 @@ namespace Microsoft.DotNet.Cli
_trackEventTask = Task.Factory.StartNew(() => InitializeTelemetry());
}
private bool PermissionExists(INuGetCacheSentinel sentinel)
{
if (sentinel == null)
{
return false;
}
return sentinel.Exists();
}
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
if (!Enabled)

View file

@ -15,7 +15,8 @@ namespace Microsoft.DotNet.Tests
{
public class GivenThatTheUserIsRunningDotNetForTheFirstTime : TestBase
{
private static CommandResult _firstDotnetUseCommandResult;
private static CommandResult _firstDotnetNonVerbUseCommandResult;
private static CommandResult _firstDotnetVerbUseCommandResult;
private static DirectoryInfo _nugetCacheFolder;
static GivenThatTheUserIsRunningDotNetForTheFirstTime()
@ -28,7 +29,8 @@ namespace Microsoft.DotNet.Tests
command.Environment["NUGET_PACKAGES"] = testNugetCache;
command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "";
_firstDotnetUseCommandResult = command.ExecuteWithCapturedOutput("new");
_firstDotnetNonVerbUseCommandResult = command.ExecuteWithCapturedOutput("--info");
_firstDotnetVerbUseCommandResult = command.ExecuteWithCapturedOutput("new");
_nugetCacheFolder = new DirectoryInfo(testNugetCache);
}
@ -36,7 +38,15 @@ namespace Microsoft.DotNet.Tests
[Fact]
public void Using_dotnet_for_the_first_time_succeeds()
{
_firstDotnetUseCommandResult.Should().Pass();
_firstDotnetVerbUseCommandResult.Should().Pass();
}
[Fact]
public void Using_dotnet_for_the_first_time_with_non_verbs_doesnt_print_eula()
{
const string firstTimeNonVerbUseMessage = @".NET Command Line Tools";
_firstDotnetNonVerbUseCommandResult.StdOut.Should().StartWith(firstTimeNonVerbUseMessage);
}
[Fact]
@ -54,12 +64,12 @@ Configuring...
-------------------
A command is running 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.";
_firstDotnetUseCommandResult.StdOut.Should().StartWith(firstTimeUseWelcomeMessage);
_firstDotnetVerbUseCommandResult.StdOut.Should().StartWith(firstTimeUseWelcomeMessage);
}
[Fact]
public void It_restores_the_nuget_packages_to_the_nuget_cache_folder()
{
{
_nugetCacheFolder.Should().HaveFile($"{GetDotnetVersion()}.dotnetSentinel");
}