Merge branch 'release/15.5' into merges/release/2.0.0-to-release/15.5-20171030-065952

This commit is contained in:
Livar 2017-10-30 09:40:54 -07:00 committed by GitHub
commit d1b1454976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 751 additions and 548 deletions

View file

@ -147,8 +147,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.TestFramew
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redist", "src\redist\redist.csproj", "{098D9321-1201-4974-A75E-F58EBCD98ACF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_roslyn", "src\tool_roslyn\tool_roslyn.csproj", "{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_msbuild", "src\tool_msbuild\tool_msbuild.csproj", "{D82A3246-9831-4024-A9B2-1932EEF3D56F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_nuget", "src\tool_nuget\tool_nuget.csproj", "{BE4C655A-DC54-4408-B739-743456D34111}"
@ -705,30 +703,6 @@ Global
{098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x64.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x64.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x86.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x86.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x64.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x64.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x86.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x86.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|Any CPU.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x64.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x64.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x86.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x86.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|x64.ActiveCfg = Release|Any CPU
@ -1625,7 +1599,6 @@ Global
{570950AD-A080-4F32-980C-F50E312910DF} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{6592A22C-2386-4E83-A4D3-FC08075C723A} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{098D9321-1201-4974-A75E-F58EBCD98ACF} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{D82A3246-9831-4024-A9B2-1932EEF3D56F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{BE4C655A-DC54-4408-B739-743456D34111} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}

View file

@ -9,7 +9,7 @@ Looking for V1 of the .NET Core tooling?
If you are looking for the v1.0.1 release of the .NET Core tools (CLI, MSBuild and the new csproj), see https://dot.net/core.
> **Note:** the release/2.0.0 branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the
> **Note:** the release/15.5 branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the
> released version of the tools available at https://dot.net/core
Found an issue?
@ -64,7 +64,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/
> **Note:** Be aware that the following installers are the **latest bits**. If you
> want to install the latest released versions, check out the [preceding section](#looking-for-v1-of-the-net-core-tooling).
| Platform | Latest Daily Build<br>*release/2.0.0*<br>[![][version-badge]][version] |
| Platform | Latest Daily Build<br>*release/15.5*<br>[![][version-badge]][version] |
| -------- | :-------------------------------------: |
| **Windows x64** | [Installer][win-x64-installer] - [Checksum][win-x64-installer-checksum]<br>[zip][win-x64-zip] - [Checksum][win-x64-zip-checksum] |
| **Windows x86** | [Installer][win-x86-installer] - [Checksum][win-x86-installer-checksum]<br>[zip][win-x86-zip] - [Checksum][win-x86-zip-checksum] |
@ -80,7 +80,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/
| **OpenSUSE 42.1** | tar.gz - See **Linux x64** |
| Latest Coherent Build<sup>2</sup><br>*release/2.0.0* |
| Latest Coherent Build<sup>2</sup><br>*release/15.5* |
|:------:|
| [![][coherent-version-badge]][coherent-version] |
@ -89,43 +89,43 @@ Reference notes:
> <br><br>**2**: *A 'coherent' build is defined as a build where the Runtime version matches between the CLI and Asp.NET.*
[comment]: # (The latest versions are always the same across all platforms. Just need one to show, so picking win-x64's svg.)
[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/latest.version
[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/win_x64_Release_version_badge.svg
[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/latest.coherent.version
[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/win_x86_Release_coherent_badge.svg
[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/latest.version
[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/win_x64_Release_version_badge.svg
[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/latest.coherent.version
[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/win_x86_Release_coherent_badge.svg
[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x64.exe
[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x64.exe.sha
[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x64.zip
[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x64.zip.sha
[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x64.exe
[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x64.exe.sha
[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x64.zip
[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x64.zip.sha
[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x86.exe
[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x86.exe.sha
[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x86.zip
[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x86.zip.sha
[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x86.exe
[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x86.exe.sha
[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x86.zip
[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-win-x86.zip.sha
[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-osx-x64.pkg
[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-osx-x64.pkg.sha
[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-osx-x64.tar.gz
[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-osx-x64.tar.gz.sha
[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-osx-x64.pkg
[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-osx-x64.pkg.sha
[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-osx-x64.tar.gz
[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-osx-x64.tar.gz.sha
[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-linux-x64.tar.gz
[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-linux-x64.tar.gz.sha
[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-linux-x64.tar.gz
[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-linux-x64.tar.gz.sha
[ubuntu-14.04-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu-x64.deb
[ubuntu-14.04-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu-x64.deb.sha
[ubuntu-14.04-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu-x64.deb
[ubuntu-14.04-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu-x64.deb.sha
[ubuntu-16.04-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu.16.04-x64.deb
[ubuntu-16.04-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu.16.04-x64.deb.sha
[ubuntu-16.04-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu.16.04-x64.deb
[ubuntu-16.04-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu.16.04-x64.deb.sha
[ubuntu-16.10-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu.16.10-x64.deb
[ubuntu-16.10-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-ubuntu.16.10-x64.deb.sha
[ubuntu-16.10-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu.16.10-x64.deb
[ubuntu-16.10-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-ubuntu.16.10-x64.deb.sha
[debian-8-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-debian-x64.deb
[debian-8-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-debian-x64.deb.sha
[debian-8-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-debian-x64.deb
[debian-8-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-debian-x64.deb.sha
[rhel-7-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-rhel-x64.rpm
[rhel-7-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-rhel-x64.rpm.sha
[rhel-7-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-rhel-x64.rpm
[rhel-7-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/15.5/dotnet-sdk-latest-rhel-x64.rpm.sha
# Debian daily feed

View file

@ -29,9 +29,6 @@
<Error Condition=" '$(MSBuildExtensionsPath)' == '' "
Text="Expected MSBuildExtensionsPath to be set, but it is not." />
<Error Condition=" '$(CscToolExe)' == '' "
Text="Expected CscToolExe to be set, but it is not." />
<Error Condition=" '$(MSBuildSDKsPath)' == '' "
Text="Expected MSBuildSDKsPath to be set, but it is not." />

View file

@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Channel>release/2.0.0</Channel>
<BranchName>release/2.0.0</BranchName>
<Channel>release/15.5</Channel>
<BranchName>release/15.5</BranchName>
</PropertyGroup>
</Project>

View file

@ -1,6 +1,6 @@
<Project ToolsVersion="14.0">
<PropertyGroup>
<SdkBrandName>Microsoft .NET Core SDK - 2.0.3</SdkBrandName>
<SdkBrandName>Microsoft .NET Core SDK - 2.1.1</SdkBrandName>
<MSBuildExtensionsBrandName>.NET Standard Support for Visual Studio 2015</MSBuildExtensionsBrandName>
<SharedFrameworkBrandName>Microsoft .NET Core Runtime - 2.0.1</SharedFrameworkBrandName>
<SharedHostBrandName>Microsoft .NET Core Host - 2.0.1</SharedHostBrandName>

View file

@ -1,10 +1,12 @@
<Project ToolsVersion="15.0">
<ItemGroup>
<BundledTemplate Include="Microsoft.DotNet.Common.ItemTemplates" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ItemTemplates" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Common.ProjectTemplates.2.0" Version="$(TemplateEngineTemplate2_0Version)" />
<BundledTemplate Include="Microsoft.DotNet.Test.ProjectTemplates.2.0" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates.2.0" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.Spa.ProjectTemplates" Version="$(SpaTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ItemTemplates" Version="$(AspnetTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates.2.0" Version="$(AspnetTemplateVersion)" />
</ItemGroup>
</Project>

View file

@ -2,29 +2,31 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CLI_SharedFrameworkVersion>2.0.0</CLI_SharedFrameworkVersion>
<CLI_MSBuild_Version>15.4.8</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.3.2-beta1-61921-05</CLI_Roslyn_Version>
<CLI_Roslyn_Satellites_Version>2.3.0-pre-20170727-1</CLI_Roslyn_Satellites_Version>
<CLI_MSBuild_Version>15.5.0-preview-000170-1090113</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.6.0-beta2-62210-01</CLI_Roslyn_Version>
<CLI_DiaSymNative_Version>1.6.0-beta2-25304</CLI_DiaSymNative_Version>
<CLI_FSharp_Version>4.2.0-rtm-171027-0</CLI_FSharp_Version>
<CLI_FSharp_Satellites_Version>4.4.1-pre-20170727-1</CLI_FSharp_Satellites_Version>
<CLI_Deps_Satellites_Build>pre-20171012-1</CLI_Deps_Satellites_Build>
<CLI_Roslyn_Satellites_Version>2.6.0-$(CLI_Deps_Satellites_Build)</CLI_Roslyn_Satellites_Version>
<CLI_FSharp_Satellites_Version>4.4.1-$(CLI_Deps_Satellites_Build)</CLI_FSharp_Satellites_Version>
<!-- We'll usually want to keep these versions in sync, but we may want to diverge in some
cases, so use separate properties but derive one from the other unless we want to
explicitly use different versions. -->
<CLI_NETSDK_Version>2.0.1-servicing-20170926-1</CLI_NETSDK_Version>
<CLI_NETSDK_Version>15.5.0-preview-20171027-2</CLI_NETSDK_Version>
<CLI_MSBuildExtensions_Version>$(CLI_NETSDK_Version)</CLI_MSBuildExtensions_Version>
<CLI_NuGet_Version>4.4.0-preview3-4475</CLI_NuGet_Version>
<CLI_NuGet_Version>4.5.0-preview2-4529</CLI_NuGet_Version>
<CLI_NETStandardLibraryNETFrameworkVersion>2.0.0-preview3-25514-04</CLI_NETStandardLibraryNETFrameworkVersion>
<CLI_WEBSDK_Version>2.0.0-rel-20170908-653</CLI_WEBSDK_Version>
<CLI_TestPlatform_Version>15.3.0-preview-20170628-02</CLI_TestPlatform_Version>
<CLI_WEBSDK_Version>2.0.0-rel-20171010-665</CLI_WEBSDK_Version>
<CLI_TestPlatform_Version>15.5.0-preview-20171012-09</CLI_TestPlatform_Version>
<SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion>
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta2-20170810-304</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170810-304</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170810-304</TemplateEngineTemplate2_0Version>
<TemplateEngineVersion>1.0.0-beta2-20171004-309</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20171004-309</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20171004-309</TemplateEngineTemplate2_0Version>
<AspnetTemplateVersion>1.0.0-beta2-20170810-304</AspnetTemplateVersion>
<PlatformAbstractionsVersion>2.0.0</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.1-alpha-167</CliCommandLineParserVersion>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="AddMetadataIsPE" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="AddToDeps" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ChangeEntryPointLibraryName" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="CheckIfAllBuildsHavePublished" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ChMod" AssemblyFile="$(CLIBuildDll)" />

View file

@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>3</VersionPatch>
<ReleaseSuffix Condition=" '$(ReleaseSuffix)' == '' ">servicing</ReleaseSuffix>
<VersionMinor>1</VersionMinor>
<VersionPatch>1</VersionPatch>
<ReleaseSuffix Condition=" '$(ReleaseSuffix)' == '' ">preview</ReleaseSuffix>
<CliVersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)</CliVersionPrefix>
<SimpleVersion Condition=" '$(DropSuffix)' == '' ">$(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount)</SimpleVersion>

View file

@ -7,8 +7,6 @@
<PropertyGroup>
<MSBuildExtensionsPathInToolPath>false</MSBuildExtensionsPathInToolPath>
<MSBuildExtensionsPathInToolPath Condition="$(MSBuildExtensionsPath.StartsWith('$(NormalizedToolPath)'))">true</MSBuildExtensionsPathInToolPath>
<CscToolExeInToolPath>false</CscToolExeInToolPath>
<CscToolExeInToolPath Condition="$(CscToolExe.StartsWith('$(NormalizedToolPath)'))">true</CscToolExeInToolPath>
<MSBuildSDKsPathInToolPath>false</MSBuildSDKsPathInToolPath>
<MSBuildSDKsPathInToolPath Condition="$(MSBuildSDKsPath.StartsWith('$(NormalizedToolPath)'))">true</MSBuildSDKsPathInToolPath>
</PropertyGroup>

View file

@ -0,0 +1,67 @@
// 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.IO;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Extensions.DependencyModel;
namespace Microsoft.DotNet.Cli.Build
{
/// <summary>
/// Merges additional .deps.json files into target .deps.json files.
/// </summary>
public class AddToDeps : Task
{
/// <summary>
/// Paths to target .deps.json files, into which <see cref="AdditionalDeps" /> will be merged.
/// These files will be overwritten with the merge result.
/// </summary>
[Required]
public string[] TargetDeps { get; set; }
/// <summary>
/// Paths to additional .deps.json files to merge into <see cref="TargetDeps" />.
/// </summary>
[Required]
public string[] AdditionalDeps { get; set; }
public override bool Execute()
{
DependencyContext additionalContext = Read(AdditionalDeps.First());
foreach (string additionalPath in AdditionalDeps.Skip(1))
{
additionalContext = additionalContext.Merge(Read(additionalPath));
}
foreach (string targetPath in TargetDeps)
{
DependencyContext targetContext = Read(targetPath).Merge(additionalContext);
Write(targetContext, targetPath);
}
return true;
}
private static DependencyContext Read(string path)
{
using (FileStream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var reader = new DependencyContextJsonReader())
{
return reader.Read(stream);
}
}
private static void Write(DependencyContext context, string path)
{
using (FileStream stream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
var writer = new DependencyContextWriter(); // unlike reader, writer is not disposable
writer.Write(context, stream);
}
}
}
}

View file

@ -30,5 +30,6 @@
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.VersionTools" Version="$(VersionToolsVersion)" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Feed" Version="1.0.0-prerelease-01929-02" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
</ItemGroup>
</Project>

View file

@ -1,18 +0,0 @@
<!--
***********************************************************************************************
Microsoft.NuGet.ImportAfter.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import NuGet.targets for Restore -->
<PropertyGroup>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'==''">$(MSBuildExtensionsPath)\NuGet.targets</NuGetRestoreTargets>
</PropertyGroup>
<Import Condition="Exists('$(NuGetRestoreTargets)')" Project="$(NuGetRestoreTargets)" />
</Project>

View file

@ -23,9 +23,8 @@ namespace Microsoft.DotNet.Cli.Utils
new Dictionary<string, string>
{
{ "MSBuildExtensionsPath", AppContext.BaseDirectory },
{ "CscToolExe", GetRunCscPath() },
{ "VbcToolExe", GetRunVbcPath() },
{ "MSBuildSDKsPath", GetMSBuildSDKsPath() }
{ "MSBuildSDKsPath", GetMSBuildSDKsPath() },
{ "DOTNET_HOST_PATH", GetDotnetPath() },
};
private readonly IEnumerable<string> _msbuildRequiredParameters =
@ -78,20 +77,9 @@ namespace Microsoft.DotNet.Cli.Utils
SdksDirectoryName);
}
private static string GetRunVbcPath()
private static string GetDotnetPath()
{
return GetRunToolPath("Vbc");
}
private static string GetRunCscPath()
{
return GetRunToolPath("Csc");
}
private static string GetRunToolPath(string compilerName)
{
var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"Run{compilerName}{scriptExtension}");
return new Muxer().MuxerPath;
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.DotNet.Cli.Utils
{
@ -83,5 +84,11 @@ namespace Microsoft.DotNet.Cli.Utils
public string EventName { get; }
public IDictionary<string, string> Properties { get; }
public IDictionary<string, double> Measurements { get; }
public ApplicationInsightsEntryFormat WithAppliedToPropertiesValue(Func<string, string> func)
{
var appliedProperties = Properties.ToDictionary(p => p.Key, p => func(p.Value));
return new ApplicationInsightsEntryFormat(EventName, appliedProperties, Measurements);
}
}
}

View file

@ -82,6 +82,7 @@ namespace Microsoft.DotNet.Cli
var command = string.Empty;
var lastArg = 0;
var cliFallbackFolderPathCalculator = new CliFallbackFolderPathCalculator();
TopLevelCommandParserResult topLevelCommandParserResult = TopLevelCommandParserResult.Empty;
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator))
using (IFirstTimeUseNoticeSentinel disposableFirstTimeUseNoticeSentinel =
new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator))
@ -120,7 +121,13 @@ namespace Microsoft.DotNet.Cli
// It's the command, and we're done!
command = args[lastArg];
if (IsDotnetBeingInvokedFromNativeInstaller(command))
if (string.IsNullOrEmpty(command))
{
command = "help";
}
topLevelCommandParserResult = new TopLevelCommandParserResult(args[lastArg]);
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
{
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
}
@ -144,7 +151,7 @@ namespace Microsoft.DotNet.Cli
telemetryClient = new Telemetry.Telemetry(firstTimeUseNoticeSentinel);
}
TelemetryEventEntry.Subscribe(telemetryClient.TrackEvent);
TelemetryEventEntry.TelemetryFilter = new TelemetryFilter();
TelemetryEventEntry.TelemetryFilter = new TelemetryFilter(Sha256Hasher.HashWithNormalizedCasing);
}
IEnumerable<string> appArgs =
@ -158,23 +165,18 @@ namespace Microsoft.DotNet.Cli
Console.WriteLine($"Telemetry is: {(telemetryClient.Enabled ? "Enabled" : "Disabled")}");
}
if (string.IsNullOrEmpty(command))
{
command = "help";
}
TelemetryEventEntry.TrackEvent(command, null, null);
TelemetryEventEntry.SendFiltered(topLevelCommandParserResult);
int exitCode;
if (BuiltInCommandsCatalog.Commands.TryGetValue(command, out var builtIn))
if (BuiltInCommandsCatalog.Commands.TryGetValue(topLevelCommandParserResult.Command, out var builtIn))
{
TelemetryEventEntry.SendFiltered(Parser.Instance.ParseFrom($"dotnet {command}", appArgs.ToArray()));
TelemetryEventEntry.SendFiltered(Parser.Instance.ParseFrom($"dotnet {topLevelCommandParserResult.Command}", appArgs.ToArray()));
exitCode = builtIn.Command(appArgs.ToArray());
}
else
{
CommandResult result = Command.Create(
"dotnet-" + command,
"dotnet-" + topLevelCommandParserResult.Command,
appArgs,
FrameworkConstants.CommonFrameworks.NetStandardApp15)
.Execute();
@ -183,9 +185,9 @@ namespace Microsoft.DotNet.Cli
return exitCode;
}
private static bool IsDotnetBeingInvokedFromNativeInstaller(string command)
private static bool IsDotnetBeingInvokedFromNativeInstaller(TopLevelCommandParserResult parseResult)
{
return command == "internal-reportinstallsuccess";
return parseResult.Command == "internal-reportinstallsuccess";
}
private static void ConfigureDotNetForFirstTimeUse(
@ -268,7 +270,7 @@ namespace Microsoft.DotNet.Cli
string currentRid = RuntimeEnvironment.GetRuntimeIdentifier();
// if the current RID isn't supported by the shared framework, display the RID the CLI was
// if the current RID isn't supported by the shared framework, display the RID the CLI was
// built with instead, so the user knows which RID they should put in their "runtimes" section.
return fxDepsFile.IsRuntimeSupported(currentRid) ?
currentRid :

View file

@ -29,9 +29,10 @@ namespace Microsoft.DotNet.Cli.Telemetry
if (firstOption != null)
{
result.Add(new ApplicationInsightsEntryFormat(
"dotnet-" + topLevelCommandNameFromParse,
"sublevelparser/command",
new Dictionary<string, string>
{
{ "verb", topLevelCommandNameFromParse},
{"argument", firstOption}
}));
}

View file

@ -31,9 +31,10 @@ namespace Microsoft.DotNet.Cli.Telemetry
if (firstArgument != null)
{
result.Add(new ApplicationInsightsEntryFormat(
"dotnet-" + topLevelCommandNameFromParse,
"sublevelparser/command",
new Dictionary<string, string>
{
{"verb", topLevelCommandNameFromParse},
{"argument", firstArgument}
}));
}

View file

@ -17,6 +17,11 @@ namespace Microsoft.DotNet.Cli.Telemetry
return HashInFormat(sha256, text);
}
public static string HashWithNormalizedCasing(string text)
{
return Hash(text.ToUpperInvariant());
}
private static string HashInFormat(SHA256 sha256, string text)
{
byte[] bytes = Encoding.UTF8.GetBytes(text);

View file

@ -120,7 +120,7 @@ namespace Microsoft.DotNet.Cli.Telemetry
Dictionary<string, string> eventProperties = GetEventProperties(properties);
Dictionary<string, double> eventMeasurements = GetEventMeasures(measurements);
_client.TrackEvent(eventName, eventProperties, eventMeasurements);
_client.TrackEvent(PrependProducerNamespace(eventName), eventProperties, eventMeasurements);
_client.Flush();
}
catch (Exception e)
@ -129,6 +129,11 @@ namespace Microsoft.DotNet.Cli.Telemetry
}
}
private static string PrependProducerNamespace(string eventName)
{
return "dotnet/cli/" + eventName;
}
private Dictionary<string, double> GetEventMeasures(IDictionary<string, double> measurements)
{
Dictionary<string, double> eventMeasurements = new Dictionary<string, double>(_commonMeasurements);

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
@ -11,48 +12,15 @@ namespace Microsoft.DotNet.Cli.Telemetry
internal class TelemetryFilter : ITelemetryFilter
{
private const string DotnetName = "dotnet";
private readonly Func<string, string> _hash;
public TelemetryFilter(Func<string, string> hash)
{
_hash = hash ?? throw new ArgumentNullException(nameof(hash));
}
public IEnumerable<ApplicationInsightsEntryFormat> Filter(object objectToFilter)
{
var ruleSet = new List<IParseResultLogRule>
{ new AllowListToSendFirstArgument(new HashSet<string>{ "new", "help" }),
new AllowListToSendFirstAppliedOptions(new HashSet<string>{ "add", "remove", "list", "sln", "nuget" }),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "new" },
optionsToLog: new HashSet<string> { "language" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "build", "publish" },
optionsToLog: new HashSet<string> { "framework", "runtime", "configuration" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "run", "clean", "test" },
optionsToLog: new HashSet<string> { "framework", "configuration" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "pack" },
optionsToLog: new HashSet<string> { "configuration" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "migrate" },
optionsToLog: new HashSet<string> { "sdk-package-version" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "vstest" },
optionsToLog: new HashSet<string> { "platform", "framework", "logger" }
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> { "publish" },
optionsToLog: new HashSet<string> { "runtime" }
)
};
var result = new List<ApplicationInsightsEntryFormat>();
if (objectToFilter is ParseResult parseResult)
@ -62,16 +30,73 @@ namespace Microsoft.DotNet.Cli.Telemetry
{
LogVerbosityForAllTopLevelCommand(result, parseResult, topLevelCommandName);
foreach (IParseResultLogRule rule in ruleSet)
foreach (IParseResultLogRule rule in ParseResultLogRules)
{
result.AddRange(rule.AllowList(parseResult));
}
}
}
else if(objectToFilter is TopLevelCommandParserResult topLevelCommandParserResult)
{
result.Add(new ApplicationInsightsEntryFormat(
"toplevelparser/command",
new Dictionary<string, string>()
{{ "verb", topLevelCommandParserResult.Command}}
));
return result;
}
else if (objectToFilter is InstallerSuccessReport installerSuccessReport)
{
result.Add(new ApplicationInsightsEntryFormat(
"install/reportsuccess",
new Dictionary<string, string> {{ "exeName", installerSuccessReport.ExeName}}
));
}
return result.Select(r => r.WithAppliedToPropertiesValue(_hash)).ToList();
}
private static List<IParseResultLogRule> ParseResultLogRules => new List<IParseResultLogRule>
{
new AllowListToSendFirstArgument(new HashSet<string> {"new", "help"}),
new AllowListToSendFirstAppliedOptions(new HashSet<string> {"add", "remove", "list", "sln", "nuget"}),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"new"},
optionsToLog: new HashSet<string> {"language"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"build", "publish"},
optionsToLog: new HashSet<string> {"framework", "runtime", "configuration"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"run", "clean", "test"},
optionsToLog: new HashSet<string> {"framework", "configuration"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"pack"},
optionsToLog: new HashSet<string> {"configuration"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"migrate"},
optionsToLog: new HashSet<string> {"sdk-package-version"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"vstest"},
optionsToLog: new HashSet<string> {"platform", "framework", "logger"}
),
new TopLevelCommandNameAndOptionToLog
(
topLevelCommandName: new HashSet<string> {"publish"},
optionsToLog: new HashSet<string> {"runtime"}
)
};
private static void LogVerbosityForAllTopLevelCommand(
ICollection<ApplicationInsightsEntryFormat> result,
ParseResult parseResult,
@ -84,9 +109,10 @@ namespace Microsoft.DotNet.Cli.Telemetry
parseResult[DotnetName][topLevelCommandName].AppliedOptions["verbosity"];
result.Add(new ApplicationInsightsEntryFormat(
"dotnet-" + topLevelCommandName,
"sublevelparser/command",
new Dictionary<string, string>()
{
{ "verb", topLevelCommandName},
{"verbosity", appliedOptions.Arguments.ElementAt(0)}
}));
}

View file

@ -36,9 +36,10 @@ namespace Microsoft.DotNet.Cli.Telemetry
parseResult[DotnetName][topLevelCommandName]
.AppliedOptions[option];
result.Add(new ApplicationInsightsEntryFormat(
"dotnet-" + topLevelCommandName,
"sublevelparser/command",
new Dictionary<string, string>
{
{ "verb", topLevelCommandName},
{option, appliedOptions.Arguments.ElementAt(0)}
}));
}

View file

@ -0,0 +1,21 @@
// 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.
namespace Microsoft.DotNet.Cli
{
internal class TopLevelCommandParserResult
{
public static TopLevelCommandParserResult Empty
{
get { return new TopLevelCommandParserResult(string.Empty); }
}
public string Command { get; }
public TopLevelCommandParserResult(string command)
{
Command = command;
}
}
}

View file

@ -1,6 +1,7 @@
// 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 Microsoft.DotNet.Tools.MSBuild;
@ -10,26 +11,7 @@ namespace Microsoft.DotNet.Tools
{
public class RestoringCommand : MSBuildForwardingApp
{
private bool NoRestore { get; }
private IEnumerable<string> ParsedArguments { get; }
private IEnumerable<string> TrailingArguments { get; }
private IEnumerable<string> ArgsToForwardToRestore()
{
var restoreArguments = ParsedArguments.Where(a =>
!a.StartsWith("/p:TargetFramework"));
if (!restoreArguments.Any(a => a.StartsWith("/verbosity:")))
{
restoreArguments = restoreArguments.Concat(new string[] { "/verbosity:q" });
}
return restoreArguments.Concat(TrailingArguments);
}
private bool ShouldRunImplicitRestore => !NoRestore;
public RestoreCommand SeparateRestoreCommand { get; }
public RestoringCommand(
IEnumerable<string> msbuildArgs,
@ -37,18 +19,64 @@ namespace Microsoft.DotNet.Tools
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
: base(GetCommandArguments(msbuildArgs, parsedArguments, noRestore), msbuildPath)
{
NoRestore = noRestore;
ParsedArguments = parsedArguments;
TrailingArguments = trailingArguments;
SeparateRestoreCommand = GetSeparateRestoreCommand(parsedArguments, trailingArguments, noRestore, msbuildPath);
}
private static IEnumerable<string> GetCommandArguments(
IEnumerable<string> msbuildArgs,
IEnumerable<string> parsedArguments,
bool noRestore)
{
if (noRestore)
{
return msbuildArgs;
}
if (HasArgumentToExcludeFromRestore(parsedArguments))
{
return Prepend("/nologo", msbuildArgs);
}
return Prepend("/restore", msbuildArgs);
}
private static RestoreCommand GetSeparateRestoreCommand(
IEnumerable<string> parsedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath)
{
if (noRestore || !HasArgumentToExcludeFromRestore(parsedArguments))
{
return null;
}
var restoreArguments = parsedArguments
.Where(a => !IsExcludedFromRestore(a))
.Concat(trailingArguments);
return RestoreCommand.FromArgs(
restoreArguments.ToArray(),
msbuildPath,
noLogo: false);
}
private static IEnumerable<string> Prepend(string argument, IEnumerable<string> arguments)
=> new[] { argument }.Concat(arguments);
private static bool HasArgumentToExcludeFromRestore(IEnumerable<string> arguments)
=> arguments.Any(a => IsExcludedFromRestore(a));
private static bool IsExcludedFromRestore(string argument)
=> argument.StartsWith("/p:TargetFramework=", StringComparison.Ordinal);
public override int Execute()
{
if (ShouldRunImplicitRestore)
if (SeparateRestoreCommand != null)
{
int exitCode = RestoreCommand.Run(ArgsToForwardToRestore().ToArray());
int exitCode = SeparateRestoreCommand.Execute();
if (exitCode != 0)
{
return exitCode;

View file

@ -37,6 +37,8 @@ namespace Microsoft.DotNet.Tools.Build
var appliedBuildOptions = result["dotnet"]["build"];
msbuildArgs.Add($"/clp:Summary");
if (appliedBuildOptions.HasOption("--no-incremental"))
{
msbuildArgs.Add("/t:Rebuild");
@ -50,8 +52,6 @@ namespace Microsoft.DotNet.Tools.Build
msbuildArgs.AddRange(appliedBuildOptions.Arguments);
msbuildArgs.Add($"/clp:Summary");
bool noRestore = appliedBuildOptions.HasOption("--no-restore");
return new BuildCommand(

View file

@ -5,6 +5,7 @@ using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Cli.Telemetry;
@ -28,12 +29,13 @@ namespace Microsoft.DotNet.Cli
var result = parser.ParseFrom("dotnet internal-reportinstallsuccess", args);
var internalReportinstallsuccess = result["dotnet"]["internal-reportinstallsuccess"];
var exeName = Path.GetFileName(internalReportinstallsuccess.Arguments.Single());
telemetry.TrackEvent(
"reportinstallsuccess",
new Dictionary<string, string> { { "exeName", exeName } },
new Dictionary<string, double>());
var filter = new TelemetryFilter(Sha256Hasher.HashWithNormalizedCasing);
foreach (var e in filter.Filter(new InstallerSuccessReport(exeName)))
{
telemetry.TrackEvent(e.EventName, e.Properties, null);
}
}
internal class ThreadBlockingTelemetry : ITelemetry
@ -54,4 +56,14 @@ namespace Microsoft.DotNet.Cli
}
}
}
internal class InstallerSuccessReport
{
public string ExeName { get; }
public InstallerSuccessReport(string exeName)
{
ExeName = exeName ?? throw new ArgumentNullException(nameof(exeName));
}
}
}

View file

@ -7,6 +7,7 @@ using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Telemetry;
using Microsoft.DotNet.Configurer;
using System.Collections.Generic;
namespace Microsoft.DotNet.Tools.MSBuild
{
@ -15,6 +16,9 @@ namespace Microsoft.DotNet.Tools.MSBuild
private readonly IFirstTimeUseNoticeSentinel _sentinel =
new FirstTimeUseNoticeSentinel(new CliFallbackFolderPathCalculator());
private readonly ITelemetry _telemetry;
private const string NewEventName = "msbuild";
private const string TargetFrameworkTelemetryEventName = "targetframeworkeval";
private const string TargetFrameworkVersionTelemetryPropertyKey= "TargetFrameworkVersion";
public MSBuildLogger()
{
@ -52,9 +56,24 @@ namespace Microsoft.DotNet.Tools.MSBuild
}
}
internal static void FormatAndSend(ITelemetry telemetry, TelemetryEventArgs args)
{
if (args.EventName == TargetFrameworkTelemetryEventName)
{
var newEventName = $"msbuild/{TargetFrameworkTelemetryEventName}";
Dictionary<string, string> maskedProperties = new Dictionary<string, string>();
if (args.Properties.TryGetValue(TargetFrameworkVersionTelemetryPropertyKey, out string value))
{
maskedProperties.Add(TargetFrameworkVersionTelemetryPropertyKey, Sha256Hasher.HashWithNormalizedCasing(value));
}
telemetry.TrackEvent(newEventName, maskedProperties, measurements: null);
}
}
private void OnTelemetryLogged(object sender, TelemetryEventArgs args)
{
_telemetry.TrackEvent(args.EventName, args.Properties, measurements: null);
FormatAndSend(_telemetry, args);
}
public override void Shutdown()

View file

@ -41,7 +41,7 @@ namespace Microsoft.DotNet.Tools.New
{
if (telemetry.Enabled)
{
telemetry.TrackEvent(name, props, measures);
telemetry.TrackEvent($"template/{name}", props, measures);
}
});
}

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tools.Restore
{
}
public static RestoreCommand FromArgs(string[] args, string msbuildPath = null)
public static RestoreCommand FromArgs(string[] args, string msbuildPath = null, bool noLogo = true)
{
DebugHelper.HandleDebugSwitch(ref args);
@ -31,17 +31,15 @@ namespace Microsoft.DotNet.Tools.Restore
var parsedRestore = result["dotnet"]["restore"];
var msbuildArgs = new List<string>
{
"/NoLogo",
"/t:Restore"
};
var msbuildArgs = new List<string>();
if (!HasVerbosityOption(parsedRestore))
if (noLogo)
{
msbuildArgs.Add("/ConsoleLoggerParameters:Verbosity=Minimal");
msbuildArgs.Add("/nologo");
}
msbuildArgs.Add("/t:Restore");
msbuildArgs.AddRange(parsedRestore.OptionValuesToBeForwarded());
msbuildArgs.AddRange(parsedRestore.Arguments);
@ -65,12 +63,5 @@ namespace Microsoft.DotNet.Tools.Restore
return cmd.Execute();
}
private static bool HasVerbosityOption(AppliedOption parsedRestore)
{
return parsedRestore.HasOption("verbosity") ||
parsedRestore.Arguments.Any(a => a.Contains("/v:")) ||
parsedRestore.Arguments.Any(a => a.Contains("/verbosity:"));
}
}
}

View file

@ -177,7 +177,7 @@ The current {1} is '{2}'.</value>
<value>Using launch settings from {0}...</value>
</data>
<data name="LaunchProfileIsNotAJsonObject" xml:space="preserve">
<value>Launch profile is not a JSON object.</value>
<value>A profile with the specified name could not be found or is not a valid JSON object.</value>
</data>
<data name="LaunchProfileHandlerCannotBeLocated" xml:space="preserve">
<value>The launch profile type '{0}' is not supported.</value>

View file

@ -103,8 +103,8 @@ Aktuální {1} je {2}.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Profil spuštění není objektem JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Profil spuštění není objektem JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ Ein ausführbares Projekt sollte ein ausführbares TFM (z.B. netcoreapp2.0) verw
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Das Startprofil ist kein JSON-Objekt.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Das Startprofil ist kein JSON-Objekt.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ El actual {1} es "{2}".</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">El perfil de inicio no es un objeto JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">El perfil de inicio no es un objeto JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ Le {1} actuel est '{2}'.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Le profil de lancement n'est pas un objet JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Le profil de lancement n'est pas un objet JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ Il valore corrente di {1} è '{2}'.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Il profilo di avvio non è un oggetto JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Il profilo di avvio non è un oggetto JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ The current {1} is '{2}'.</source>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">起動プロファイルが JSON オブジェクトではありません。</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">起動プロファイルが JSON オブジェクトではありません。</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ The current {1} is '{2}'.</source>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">시작 프로필이 JSON 개체가 아닙니다.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">시작 프로필이 JSON 개체가 아닙니다.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ Bieżący element {1}: „{2}”.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Profil uruchamiania nie jest obiektem JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Profil uruchamiania nie jest obiektem JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ O {1} atual é '{2}'.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">O perfil de inicialização não é um objeto JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">O perfil de inicialização não é um objeto JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ The current {1} is '{2}'.</source>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Профиль запуска не является объектом JSON.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Профиль запуска не является объектом JSON.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ Geçerli {1}: '{2}'.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">Başlatma profili bir JSON nesnesi değil.</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">Başlatma profili bir JSON nesnesi değil.</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ The current {1} is '{2}'.</source>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">启动配置文件不是 JSON 对象。</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">启动配置文件不是 JSON 对象。</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -103,8 +103,8 @@ The current {1} is '{2}'.</source>
<note />
</trans-unit>
<trans-unit id="LaunchProfileIsNotAJsonObject">
<source>Launch profile is not a JSON object.</source>
<target state="translated">啟動設定檔並非 JSON 物件。</target>
<source>A profile with the specified name could not be found or is not a valid JSON object.</source>
<target state="needs-review-translation">啟動設定檔並非 JSON 物件。</target>
<note />
</trans-unit>
<trans-unit id="LaunchProfileHandlerCannotBeLocated">

View file

@ -17,15 +17,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="$(CLI_SharedFrameworkVersion)" />
<PackageReference Include="Microsoft.Build.Runtime" Version="$(CLI_MSBuild_Version)" />
<PackageReference Include="NuGet.Build.Tasks" Version="$(CLI_NuGet_Version)" />
<PackageReference Include="Microsoft.TestPlatform.CLI" Version="$(CLI_TestPlatform_Version)" />
<PackageReference Include="Microsoft.TestPlatform.Build" Version="$(CLI_TestPlatform_Version)" />
<PackageReference Include="NuGet.ProjectModel" Version="$(CLI_NuGet_Version)" />
<!-- The project json migration commands depend on an older version of Roslyn.
Lift the version here to match what tool_roslyn depends on (otherwise an older version will
be added to the TPA when we crossgen and we won't be able to crossgen tool_roslyn -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(CLI_Roslyn_Version)" />
<PackageReference Include="Microsoft.NETCore.Compilers" Version="$(CLI_Roslyn_Version)">
<ExcludeAssets>All</ExcludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@ -74,9 +72,33 @@
<Target Name="PublishRoslyn"
BeforeTargets="Publish">
<DotNetPublish ToolPath="$(Stage0Directory)"
Configuration="$(Configuration)"
ProjectPath="$(SrcDirectory)/tool_roslyn/tool_roslyn.csproj" />
<ItemGroup>
<RoslynBits Include="$(NuGetPackagesDir)/microsoft.netcore.compilers/$(CLI_Roslyn_Version)/tools/**/*" />
</ItemGroup>
<Copy SourceFiles="@(RoslynBits)" DestinationFiles="@(RoslynBits->'$(RoslynDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(RoslynSatelliteBits)" DestinationFiles="@(RoslynSatelliteBits->'$(RoslynDirectory)/bincore/%(RecursiveDir)%(Filename)%(Extension)')" />
<ItemGroup>
<RoslynRuntimeConfigs Include="$(RoslynDirectory)/bincore/csc.runtimeconfig.json" />
<RoslynRuntimeConfigs Include="$(RoslynDirectory)/bincore/vbc.runtimeconfig.json" />
<RoslynDeps Include="$(RoslynDirectory)/bincore/csc.deps.json" />
<RoslynDeps Include="$(RoslynDirectory)/bincore/vbc.deps.json" />
<RoslynSatelliteDeps Include="$(RoslynDirectory)/bincore/tool_roslyn_satellites.deps.json" />
</ItemGroup>
<PropertyGroup>
<ReplacementPattern>"version": ".*"</ReplacementPattern>
<ReplacementString>"version": "$(CLI_SharedFrameworkVersion)"</ReplacementString>
</PropertyGroup>
<ReplaceFileContents
InputFile="%(RoslynRuntimeConfigs.Identity)"
DestinationFile="%(RoslynRuntimeConfigs.Identity)"
ReplacementPatterns="$(ReplacementPattern)"
ReplacementStrings="$(ReplacementString)" />
<DotNetPublish
ToolPath="$(Stage0Directory)"
Configuration="$(Configuration)"
ProjectPath="$(SrcDirectory)/tool_roslyn_satellites/tool_roslyn_satellites.csproj" />
<AddToDeps TargetDeps="@(RoslynDeps)" AdditionalDeps="@(RoslynSatelliteDeps)" />
<Delete Files="@(RoslynSatelliteDeps)" />
</Target>
<Target Name="PublishFSharp"
@ -200,41 +222,72 @@
Condition=" '$(DISABLE_CROSSGEN)' == '' "
AfterTargets="PublishMSBuildExtensions">
<ItemGroup>
<RoslynFiles Include="$(PublishDir)Roslyn\bincore\**\*" />
<FSharpFiles Include="$(PublishDir)FSharp\**\*" Exclude="$(PublishDir)FSharp\FSharp.Build.dll" />
<RemainingFiles Include="$(PublishDir)**\*" Exclude="@(RoslynFiles);@(FSharpFiles)" />
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
<SdkFiles Include="$(PublishDir)/**/*" Exclude="$(PublishDir)/TestHost*/**/*;$(PublishDir)/Sdks/**/*" />
<RemainingFiles Remove="$(PublishDir)TestHost*\**\*" />
<RemainingFiles Remove="$(PublishDir)Sdks\**\*" />
<!-- Don't try to CrossGen .NET Framework support assemblies for .NET Standard -->
<SdkFiles Remove="$(PublishDir)/Microsoft\Microsoft.NET.Build.Extensions\net*\**\*" />
<RemainingFiles Remove="$(PublishDir)Microsoft\Microsoft.NET.Build.Extensions\net*\**\*" />
<!-- Don't try to CrossGen tasks and supporting DLLs compiled for .NET Framework -->
<SdkFiles Remove="$(PublishDir)/Microsoft\Microsoft.NET.Build.Extensions\tools\net*\**\*" />
<RemainingFiles Remove="$(PublishDir)Microsoft\Microsoft.NET.Build.Extensions\tools\net*\**\*" />
</ItemGroup>
<AddMetadataIsPE Items="@(SdkFiles)">
<Output TaskParameter="ResultItems" ItemName="SdkFilesWithPEMarker" />
<AddMetadataIsPE Items="@(RoslynFiles)">
<Output TaskParameter="ResultItems" ItemName="RoslynFilesWithPEMarker" />
</AddMetadataIsPE>
<AddMetadataIsPE Items="@(FSharpFiles)">
<Output TaskParameter="ResultItems" ItemName="FSharpFilesWithPEMarker" />
</AddMetadataIsPE>
<AddMetadataIsPE Items="@(RemainingFiles)">
<Output TaskParameter="ResultItems" ItemName="RemainingFilesWithPEMarker" />
</AddMetadataIsPE>
<ItemGroup>
<CrossgenTargets Include="%(SdkFilesWithPEMarker.FullPath)" Condition=" '%(SdkFilesWithPEMarker.IsPE)' == 'True' " />
<RoslynTargets Include="%(RoslynFilesWithPEMarker.FullPath)" Condition=" '%(RoslynFilesWithPEMarker.IsPE)' == 'True' " />
<FSharpTargets Include="%(FSharpFilesWithPEMarker.FullPath)" Condition=" '%(FSharpFilesWithPEMarker.IsPE)' == 'True' " />
<RemainingTargets Include="%(RemainingFilesWithPEMarker.FullPath)" Condition=" '%(RemainingFilesWithPEMarker.IsPE)' == 'True' " />
<RoslynFolders Include="@(RoslynTargets-&gt;DirectoryName()-&gt;Distinct())" />
<FSharpFolders Include="@(FSharpTargets-&gt;DirectoryName()-&gt;Distinct())" />
<RemainingFolders Include="@(RemainingTargets-&gt;DirectoryName()-&gt;Distinct())" />
<!-- FSharp.Build.dll causes the FSharp folder to be included. Remove it, as we don't want other FSharp dlls being included in the crossgen. -->
<RemainingFolders Remove="$(PublishDir)FSharp\**\*" />
</ItemGroup>
<RemoveDuplicates Inputs="@(SdkFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="PublishDirSubDirectories" />
</RemoveDuplicates>
<!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 -->
<Chmod Condition=" '$(OSName)' != 'win' "
Glob="$(CrossgenPath)"
Mode="u+x" />
<Crossgen SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);
@(PublishDirSubDirectories);
$(SharedFrameworkNameVersionPath)" />
<Crossgen
SourceAssembly="%(RoslynTargets.FullPath)"
DestinationPath="%(RoslynTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);@(RoslynFolders);$(SharedFrameworkNameVersionPath)" />
<Crossgen
SourceAssembly="%(FSharpTargets.FullPath)"
DestinationPath="%(FSharpTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);@(FSharpFolders);$(SharedFrameworkNameVersionPath)" />
<Crossgen
SourceAssembly="%(RemainingTargets.FullPath)"
DestinationPath="%(RemainingTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);@(RemainingFolders);$(SharedFrameworkNameVersionPath)" />
</Target>
<Target Name="ChmodPublishDir"
@ -243,8 +296,6 @@
<Exec Command="find $(SdkOutputDirectory) -type d -exec chmod 755 {} \;" />
<Exec Command="find $(SdkOutputDirectory) -type f -exec chmod 644 {} \;" />
<Chmod Mode="755" Glob="$(SdkOutputDirectory)/Roslyn/RunCsc.sh" />
<Chmod Mode="755" Glob="$(SdkOutputDirectory)/Roslyn/RunVbc.sh" />
<Chmod Mode="755" Glob="$(SdkOutputDirectory)/FSharp/RunFsc.sh" />
</Target>

View file

@ -1,6 +0,0 @@
@echo off
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.
"%~dp0..\..\..\dotnet" "%~dp0csc.exe" %*

View file

@ -1,17 +0,0 @@
#!/usr/bin/env bash
#
# 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.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
"$DIR/../../../dotnet" "$DIR/csc.exe" "$@"

View file

@ -1,6 +0,0 @@
@echo off
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.
"%~dp0..\..\..\dotnet" "%~dp0vbc.exe" %*

View file

@ -1,17 +0,0 @@
#!/usr/bin/env bash
#
# 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.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
"$DIR/../../../dotnet" "$DIR/vbc.exe" "$@"

View file

@ -1,68 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
<PropertyGroup>
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PublishDir>$(RoslynDirectory)</PublishDir>
<VersionSuffix>$(CommitCount)</VersionSuffix>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NetCore.App" Version="$(CLI_SharedFrameworkVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(CLI_Roslyn_Version)" />
<PackageReference Include="Microsoft.CodeAnalysis.Build.Tasks" Version="$(CLI_Roslyn_Version)" />
<PackageReference Include="Microsoft.Net.Compilers.netcore" Version="$(CLI_Roslyn_Version)" />
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(CLI_DiaSymNative_Version)" Condition="'$(OSName)' == 'win'" />
<PackageReference Include="CliDeps.Satellites.Roslyn" Version="$(CLI_Roslyn_Satellites_Version)" />
</ItemGroup>
<ItemGroup>
<Content Include="RunCsc.sh;RunCsc.cmd;RunVbc.sh;RunVbc.cmd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<Target Name="MakeCscAndVbcRunnableAndMoveToPublishDir"
AfterTargets="Publish"
BeforeTargets="RemoveFilesAfterPublish">
<ItemGroup>
<AssetsToRemoveFromDeps Include="runtimes/any/native/csc.dll"
SectionName="runtimeTargets" />
<AssetsToRemoveFromDeps Include="runtimes/any/native/vbc.dll"
SectionName="runtimeTargets" />
<AssetsToRemoveFromDeps Include="tool_roslyn.dll"
SectionName="runtime"/>
</ItemGroup>
<RemoveAssetFromDepsPackages DepsFile="$(PublishDir)/$(TargetName).deps.json"
SectionName="%(AssetsToRemoveFromDeps.SectionName)"
AssetPath="%(AssetsToRemoveFromDeps.Identity)" />
<Copy SourceFiles="$(PublishDir)/runtimes/any/native/csc.dll;
$(PublishDir)/$(TargetName).runtimeconfig.json;
$(PublishDir)/$(TargetName).deps.json;"
DestinationFiles="$(PublishDir)/csc.exe;
$(PublishDir)/csc.runtimeconfig.json;
$(PublishDir)/csc.deps.json;" />
<Copy SourceFiles="$(PublishDir)/runtimes/any/native/vbc.dll;
$(PublishDir)/$(TargetName).runtimeconfig.json;
$(PublishDir)/$(TargetName).deps.json;"
DestinationFiles="$(PublishDir)/vbc.exe;
$(PublishDir)/vbc.runtimeconfig.json;
$(PublishDir)/vbc.deps.json;" />
</Target>
<Target Name="RemoveFilesAfterPublish"
AfterTargets="Publish">
<Delete Files="$(PublishDir)/$(TargetName).dll" />
<Delete Files="$(PublishDir)/$(TargetName).pdb" />
<Delete Files="$(PublishDir)/$(TargetName).runtimeconfig.json" />
<Delete Files="$(PublishDir)/$(TargetName).deps.json" />
</Target>
</Project>

View file

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
<PropertyGroup>
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<PublishDir>$(RoslynDirectory)/bincore</PublishDir>
<VersionSuffix>$(CommitCount)</VersionSuffix>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NetCore.App" Version="$(CLI_SharedFrameworkVersion)" />
<PackageReference Include="CliDeps.Satellites.Roslyn" Version="$(CLI_Roslyn_Satellites_Version)" />
</ItemGroup>
<Target Name="MoveBuildTasksSatellitesAndRemoveBuildOutputAsset"
AfterTargets="Publish">
<RemoveAssetFromDepsPackages DepsFile="$(PublishDir)/$(TargetName).deps.json"
SectionName="runtime"
AssetPath="$(TargetFileName)" />
<ItemGroup>
<BuildTaskSatellites Include="$(PublishDir)/**/Microsoft.Build.Tasks.CodeAnalysis.resources.dll" />
</ItemGroup>
<Move SourceFiles="@(BuildTaskSatellites)"
DestinationFiles="@(BuildTaskSatellites->'$(PublishDir)/../%(RecursiveDir)/%(Filename)%(Extension)')" />
</Target>
</Project>

View file

@ -10,7 +10,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
public class GivenDotnetBuildInvocation
{
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m";
const string ExpectedSuffix = "/clp:Summary";
[Theory]
[InlineData(new string[] { }, "/t:Build")]
@ -19,8 +18,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "--output", "foo" }, "/t:Build /p:OutputPath=foo")]
[InlineData(new string[] { "-o", "foo1 foo2" }, "/t:Build \"/p:OutputPath=foo1 foo2\"")]
[InlineData(new string[] { "--no-incremental" }, "/t:Rebuild")]
[InlineData(new string[] { "-f", "tfm" }, "/t:Build /p:TargetFramework=tfm")]
[InlineData(new string[] { "--framework", "tfm" }, "/t:Build /p:TargetFramework=tfm")]
[InlineData(new string[] { "-r", "rid" }, "/t:Build /p:RuntimeIdentifier=rid")]
[InlineData(new string[] { "--runtime", "rid" }, "/t:Build /p:RuntimeIdentifier=rid")]
[InlineData(new string[] { "-c", "config" }, "/t:Build /p:Configuration=config")]
@ -29,14 +26,45 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "--no-dependencies" }, "/t:Build /p:BuildProjectReferences=false")]
[InlineData(new string[] { "-v", "diag" }, "/t:Build /verbosity:diag")]
[InlineData(new string[] { "--verbosity", "diag" }, "/t:Build /verbosity:diag")]
[InlineData(new string[] { "--no-incremental", "-o", "myoutput", "-r", "myruntime", "-v", "diag" }, "/t:Rebuild /p:OutputPath=myoutput /p:RuntimeIdentifier=myruntime /verbosity:diag")]
[InlineData(new string[] { "--no-incremental", "-o", "myoutput", "-r", "myruntime", "-v", "diag", "/ArbitrarySwitchForMSBuild" },
"/t:Rebuild /p:OutputPath=myoutput /p:RuntimeIdentifier=myruntime /verbosity:diag /ArbitrarySwitchForMSBuild")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
BuildCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs} {ExpectedSuffix}");
var command = BuildCommand.FromArgs(args, msbuildPath);
command.SeparateRestoreCommand.Should().BeNull();
command.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} /restore /clp:Summary{expectedAdditionalArgs}");
}
[Theory]
[InlineData(new string[] { "-f", "tfm" }, "/t:Restore", "/t:Build /p:TargetFramework=tfm")]
[InlineData(new string[] { "-o", "myoutput", "-f", "tfm", "-v", "diag", "/ArbitrarySwitchForMSBuild" },
"/t:Restore /p:OutputPath=myoutput /verbosity:diag /ArbitrarySwitchForMSBuild",
"/t:Build /p:OutputPath=myoutput /p:TargetFramework=tfm /verbosity:diag /ArbitrarySwitchForMSBuild")]
public void MsbuildInvocationIsCorrectForSeparateRestore(
string[] args,
string expectedAdditionalArgsForRestore,
string expectedAdditionalArgs)
{
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
var command = BuildCommand.FromArgs(args, msbuildPath);
command.SeparateRestoreCommand.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} {expectedAdditionalArgsForRestore}");
command.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} /nologo /clp:Summary{expectedAdditionalArgs}");
}
}
}

View file

@ -11,7 +11,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
{
public class GivenDotnetPackInvocation
{
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /t:pack";
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /restore /t:pack";
[Theory]
[InlineData(new string[] { }, "")]
@ -33,8 +33,10 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
PackCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
var command = PackCommand.FromArgs(args, msbuildPath);
command.SeparateRestoreCommand.Should().BeNull();
command.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
}
}
}

View file

@ -20,12 +20,10 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
this.output = output;
}
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /t:Publish";
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m";
[Theory]
[InlineData(new string[] { }, "")]
[InlineData(new string[] { "-f", "<tfm>" }, "/p:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "/p:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, "/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, "/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "-o", "<publishdir>" }, "/p:PublishDir=<publishdir>")]
@ -43,10 +41,35 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
PublishCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
var command = PublishCommand.FromArgs(args, msbuildPath);
command.SeparateRestoreCommand
.Should()
.BeNull();
command.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} /restore /t:Publish{expectedAdditionalArgs}");
}
[Theory]
[InlineData(new string[] { "-f", "<tfm>" }, "/p:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "/p:TargetFramework=<tfm>")]
public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string expectedAdditionalArgs)
{
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
var command = PublishCommand.FromArgs(args, msbuildPath);
command.SeparateRestoreCommand
.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} /t:Restore");
command.GetProcessStartInfo()
.Arguments.Should()
.Be($"{ExpectedPrefix} /nologo /t:Publish{expectedAdditionalArgs}");
}
[Theory]

View file

@ -11,10 +11,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
public class GivenDotnetRestoreInvocation
{
private const string ExpectedPrefix =
"exec <msbuildpath> /m /v:m /NoLogo /t:Restore";
private string ExpectedPrefixWithConsoleLoggerParamaters =
$"{ExpectedPrefix} /ConsoleLoggerParameters:Verbosity=Minimal";
"exec <msbuildpath> /m /v:m /nologo /t:Restore";
[Theory]
[InlineData(new string[] { }, "")]
@ -30,19 +27,9 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "--no-cache" }, "/p:RestoreNoCache=true")]
[InlineData(new string[] { "--ignore-failed-sources" }, "/p:RestoreIgnoreFailedSources=true")]
[InlineData(new string[] { "--no-dependencies" }, "/p:RestoreRecursive=false")]
public void MsbuildInvocationWithConsoleLoggerParametersIsCorrect(string[] args, string expectedAdditionalArgs)
{
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>";
RestoreCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments
.Should().Be($"{ExpectedPrefixWithConsoleLoggerParamaters}{expectedAdditionalArgs}");
}
[InlineData(new string[] { "-v", "minimal" }, @"/verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, @"/verbosity:minimal")]
public void MsbuildInvocationWithVerbosityIsCorrect(string[] args, string expectedAdditionalArgs)
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");

View file

@ -0,0 +1,76 @@
// 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 FluentAssertions;
using Xunit;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Cli.Telemetry;
using Microsoft.Build.Framework;
using System.Collections.Generic;
namespace Microsoft.DotNet.Cli.MSBuild.Tests
{
public class GivenMSBuildLogger
{
[Fact(DisplayName = "It blocks telemetry that is not in the list")]
public void ItBlocks()
{
var fakeTelemetry = new FakeTelemetry();
var telemetryEventArgs = new TelemetryEventArgs
{
EventName = "User Defined Event Name",
Properties = new Dictionary<string, string>
{
{ "User Defined Key", "User Defined Value"},
}
};
MSBuildLogger.FormatAndSend(fakeTelemetry, telemetryEventArgs);
fakeTelemetry.LogEntry.Should().BeNull();
}
[Fact(DisplayName = "It masks event name with targetframeworkeval only on TargetFrameworkVersion")]
public void ItMasksTargetFrameworkEventname()
{
var fakeTelemetry = new FakeTelemetry();
var telemetryEventArgs = new TelemetryEventArgs
{
EventName = "targetframeworkeval",
Properties = new Dictionary<string, string>
{
{ "TargetFrameworkVersion", ".NETStandard,Version=v2.0"},
}
};
MSBuildLogger.FormatAndSend(fakeTelemetry, telemetryEventArgs);
fakeTelemetry.LogEntry.EventName.Should().Be("msbuild/targetframeworkeval");
fakeTelemetry.LogEntry.Properties.Keys.Count.Should().Be(1);
var expectedKey = "TargetFrameworkVersion";
fakeTelemetry.LogEntry.Properties.Should().ContainKey(expectedKey);
fakeTelemetry.LogEntry.Properties[expectedKey].Should().Be(Sha256Hasher.Hash(".NETSTANDARD,VERSION=V2.0"));
}
public class FakeTelemetry : ITelemetry
{
public bool Enabled { get; set; }
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
LogEntry = new LogEntry { EventName = eventName, Properties = properties, Measurement = measurements };
}
public LogEntry LogEntry { get; private set; }
}
public class LogEntry
{
public string EventName { get; set; }
public IDictionary<string, string> Properties { get; set; }
public IDictionary<string, double> Measurement { get; set; }
}
}
}

View file

@ -31,8 +31,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[Theory]
[InlineData("MSBuildExtensionsPath")]
[InlineData("CscToolExe")]
[InlineData("VbcToolExe")]
[InlineData("MSBuildSDKsPath")]
[InlineData("DOTNET_CLI_TELEMETRY_SESSIONID")]
public void ItSetsEnvironmentalVariables(string envVarName)
@ -66,28 +64,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
.Exist();
}
[Fact]
public void ItSetsCscToolExePathToValidPath()
{
var msbuildPath = "<msbuildpath>";
var envVar = "CscToolExe";
new FileInfo(new MSBuildForwardingApp(new string[0], msbuildPath)
.GetProcessStartInfo()
.Environment[envVar])
.Should().NotBeNull("constructor will throw on invalid path");
}
[Fact]
public void ItSetsVbcToolExePathToValidPath()
{
var msbuildPath = "<msbuildpath>";
var envVar = "VbcToolExe";
new FileInfo(new MSBuildForwardingApp(new string[0], msbuildPath)
.GetProcessStartInfo()
.Environment[envVar])
.Should().NotBeNull("constructor will throw on invalid path");
}
[Fact]
public void ItSetsOrIgnoresTelemetrySessionId()
{

View file

@ -39,9 +39,9 @@ namespace Microsoft.DotNet.Cli.Test.Tests
{
result.StdOut
.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.", "because .NET 4.6 tests will pass")
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop", "because .NET 4.6 tests will pass")
.And.Contain("Passed VSTestPassTestDesktop", "because .NET 4.6 tests will pass")
.And.Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.", "because netcoreapp2.0 tests will fail")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp", "because netcoreapp2.0 tests will fail");
.And.Contain("Failed VSTestFailTestNetCoreApp", "because netcoreapp2.0 tests will fail");
}
result.ExitCode.Should().Be(1);
}

View file

@ -28,8 +28,8 @@ namespace Microsoft.DotNet.Cli.Test.Tests
if (!DotnetUnderTest.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.StdOut.Should().Contain("Passed VSTestPassTest");
result.StdOut.Should().Contain("Failed VSTestFailTest");
}
result.ExitCode.Should().Be(1);
@ -52,8 +52,8 @@ namespace Microsoft.DotNet.Cli.Test.Tests
if (!DotnetUnderTest.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.StdOut.Should().Contain("Passed VSTestPassTest");
result.StdOut.Should().Contain("Failed VSTestFailTest");
}
result.ExitCode.Should().Be(1);
@ -227,8 +227,8 @@ namespace Microsoft.DotNet.Cli.Test.Tests
if (!DotnetUnderTest.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.StdOut.Should().Contain("Passed VSTestPassTest");
result.StdOut.Should().Contain("Failed VSTestFailTest");
}
result.ExitCode.Should().Be(1);

View file

@ -42,8 +42,8 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
{
result.StdOut
.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.")
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTest")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
.And.Contain("Passed VSTestPassTest")
.And.Contain("Failed VSTestFailTest");
}
result.ExitCode.Should().Be(1);

View file

@ -16,116 +16,144 @@ namespace Microsoft.DotNet.Tests
private readonly FakeRecordEventNameTelemetry _fakeTelemetry;
public string EventName { get; set; }
public IDictionary<string, string> Properties { get; set; }
public TelemetryCommandTests()
{
_fakeTelemetry = new FakeRecordEventNameTelemetry();
TelemetryEventEntry.Subscribe(_fakeTelemetry.TrackEvent);
TelemetryEventEntry.TelemetryFilter = new TelemetryFilter();
TelemetryEventEntry.TelemetryFilter = new TelemetryFilter(Sha256Hasher.HashWithNormalizedCasing);
}
[Fact]
public void TopLevelCommandNameShouldBeSentToTelemetry()
{
string[] args = {"help"};
string[] args = { "help" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == args[0]);
_fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "toplevelparser/command" &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("HELP"));
}
[Fact]
public void DotnetNewCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "console";
string[] args = {"new", argumentToSend};
string[] args = { "new", argumentToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-new" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("NEW"));
}
[Fact]
public void DotnetHelpCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "something";
string[] args = {"help", argumentToSend};
string[] args = { "help", argumentToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-help" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("HELP"));
}
[Fact]
public void DotnetAddCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "package";
string[] args = {"add", argumentToSend, "aPackageName"};
string[] args = { "add", argumentToSend, "aPackageName" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-add" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("ADD"));
}
[Fact]
public void DotnetAddCommandFirstArgumentShouldBeSentToTelemetry2()
{
const string argumentToSend = "reference";
string[] args = {"add", argumentToSend, "aPackageName"};
string[] args = { "add", argumentToSend, "aPackageName" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-add" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("ADD"));
}
[Fact]
public void DotnetRemoveCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "package";
string[] args = {"remove", argumentToSend, "aPackageName"};
string[] args = { "remove", argumentToSend, "aPackageName" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-remove" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("REMOVE"));
}
[Fact]
public void DotnetListCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "reference";
string[] args = {"list", argumentToSend, "aPackageName"};
string[] args = { "list", argumentToSend, "aPackageName" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-list" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("LIST"));
}
[Fact]
public void DotnetSlnCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "list";
string[] args = {"sln", "aSolution", argumentToSend};
string[] args = { "sln", "aSolution", argumentToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-sln" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("SLN"));
}
[Fact]
public void DotnetNugetCommandFirstArgumentShouldBeSentToTelemetry()
{
const string argumentToSend = "push";
string[] args = {"nuget", argumentToSend, "aRoot"};
string[] args = { "nuget", argumentToSend, "aRoot" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-nuget" && e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == argumentToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey("argument") &&
e.Properties["argument"] == Sha256Hasher.Hash(argumentToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("NUGET"));
}
[Fact]
@ -133,12 +161,14 @@ namespace Microsoft.DotNet.Tests
{
const string optionKey = "language";
const string optionValueToSend = "c#";
string[] args = {"new", "console", "--" + optionKey, optionValueToSend};
string[] args = { "new", "console", "--" + optionKey, optionValueToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-new" && e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == optionValueToSend);
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == Sha256Hasher.Hash(optionValueToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("NEW"));
}
[Fact]
@ -146,12 +176,15 @@ namespace Microsoft.DotNet.Tests
{
const string optionKey = "verbosity";
const string optionValueToSend = "minimal";
string[] args = {"restore", "--" + optionKey, optionValueToSend};
string[] args = { "restore", "--" + optionKey, optionValueToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-restore" && e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == optionValueToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == Sha256Hasher.Hash(optionValueToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("RESTORE"));
}
[Fact]
@ -159,12 +192,15 @@ namespace Microsoft.DotNet.Tests
{
const string optionKey = "configuration";
const string optionValueToSend = "Debug";
string[] args = {"build", "--" + optionKey, optionValueToSend};
string[] args = { "build", "--" + optionKey, optionValueToSend };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-build" && e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == optionValueToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == Sha256Hasher.Hash(optionValueToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("BUILD"));
}
[Fact]
@ -176,40 +212,51 @@ namespace Microsoft.DotNet.Tests
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-publish" && e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == optionValueToSend);
.Contain(e => e.EventName == "sublevelparser/command" &&
e.Properties.ContainsKey(optionKey) &&
e.Properties[optionKey] == Sha256Hasher.Hash(optionValueToSend.ToUpper()) &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("PUBLISH"));
}
[Fact]
public void DotnetBuildAndPublishCommandOpinionsShouldBeSentToTelemetryWhenThereIsMultipleOption()
{
string[] args = {"build", "--configuration", "Debug", "--runtime", "osx.10.11-x64"};
string[] args = { "build", "--configuration", "Debug", "--runtime", "osx.10.11-x64" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-build" && e.Properties.ContainsKey("configuration") &&
e.Properties["configuration"] == "Debug");
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("configuration") &&
e.Properties["configuration"] == Sha256Hasher.Hash("DEBUG") &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("BUILD"));
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-build" && e.Properties.ContainsKey("runtime") &&
e.Properties["runtime"] == "osx.10.11-x64");
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("runtime") &&
e.Properties["runtime"] == Sha256Hasher.Hash("OSX.10.11-X64") &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("BUILD"));
}
[Fact]
public void DotnetRunCleanTestCommandOpinionsShouldBeSentToTelemetryWhenThereIsMultipleOption()
{
string[] args = {"clean", "--configuration", "Debug", "--framework", "netcoreapp1.0"};
string[] args = { "clean", "--configuration", "Debug", "--framework", "netcoreapp1.0" };
Cli.Program.ProcessArgs(args);
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-clean" && e.Properties.ContainsKey("configuration") &&
e.Properties["configuration"] == "Debug");
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("configuration") &&
e.Properties["configuration"] == Sha256Hasher.Hash("DEBUG") &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("CLEAN"));
_fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "dotnet-clean" && e.Properties.ContainsKey("framework") &&
e.Properties["framework"] == "netcoreapp1.0");
.Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("framework") &&
e.Properties["framework"] == Sha256Hasher.Hash("NETCOREAPP1.0") &&
e.Properties.ContainsKey("verb") &&
e.Properties["verb"] == Sha256Hasher.Hash("CLEAN"));
}
[WindowsOnlyFact]
@ -222,8 +269,8 @@ namespace Microsoft.DotNet.Tests
fakeTelemetry
.LogEntries.Should()
.Contain(e => e.EventName == "reportinstallsuccess" && e.Properties.ContainsKey("exeName") &&
e.Properties["exeName"] == "dotnet-sdk-latest-win-x64.exe");
.Contain(e => e.EventName == "install/reportsuccess" && e.Properties.ContainsKey("exeName") &&
e.Properties["exeName"] == Sha256Hasher.Hash("DOTNET-SDK-LATEST-WIN-X64.EXE"));
}
[Fact]

View file

@ -1,38 +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.Concurrent;
using System.Collections.Generic;
using Microsoft.DotNet.Cli;
namespace Microsoft.DotNet.Cli.MSBuild.IntegrationTests
{
public class FakeRecordEventNameTelemetry
{
public bool Enabled { get; set; }
public string EventName { get; set; }
public void TrackEvent(string eventName,
IDictionary<string, string> properties,
IDictionary<string, double> measurements)
{
LogEntries.Add(
new LogEntry
{
EventName = eventName,
Measurement = measurements,
Properties = properties
});
}
public ConcurrentBag<LogEntry> LogEntries { get; set; } = new ConcurrentBag<LogEntry>();
public class LogEntry
{
public string EventName { get; set; }
public IDictionary<string, string> Properties { get; set; }
public IDictionary<string, double> Measurement { get; set; }
}
}
}