diff --git a/Common.props b/Common.props index c81a8fe3c5d1..f98067f954bf 100644 --- a/Common.props +++ b/Common.props @@ -30,6 +30,7 @@ 2.1.0 20170101 preview1 + $(BUILD_BUILDNUMBER) 00000001-01 diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 28e8a89aadc1..8ab6e93ac144 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.1.0-preview1-007041 \ No newline at end of file +2.0.2-vspre-006963 diff --git a/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/DesktopUsingPackageWithSatellites.csproj b/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/DesktopUsingPackageWithSatellites.csproj deleted file mode 100644 index 2ff0fb12dc8a..000000000000 --- a/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/DesktopUsingPackageWithSatellites.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - net46 - - - - - - - \ No newline at end of file diff --git a/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/Program.cs b/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/Program.cs deleted file mode 100644 index 497c08f8fda8..000000000000 --- a/TestAssets/TestProjects/DesktopUsingPackageWithSatellites/Program.cs +++ /dev/null @@ -1,15 +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; - -namespace TestApp -{ - class Program - { - static void Main() - { - Console.WriteLine("Hello World"); - } - } -} diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 35507b8743d7..e3f7b5973029 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,10 +10,10 @@ 15.2.0-preview-000093-02 2.0.0-preview1-001960 2.0.0-preview1-001960 - 4.4.0-preview1-4365 + 4.4.0-preview3-4475 9.0.1 1.4.2 - 2.0.0-preview2-25405-01 + 2.0.1-servicing-25708-01 0.2.0-beta-000042 diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index fcea8d0426c8..201b1167d52f 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -313,6 +313,6 @@ Resolved file has a bad image, no metadata, or is otherwise inaccessible. {0} - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 31db50aa987b..ca6bb6b09eea 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -318,8 +318,8 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - Verze sady Microsoft.NET.Sdk používaná tímto projektem nestačí pro podporu sady .NET Standard 2.0, kterou vyžadují odkazy tohoto projektu. Nainstalujte verzi 2.0 nebo vyšší sady .NET Core SDK. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + Verze sady Microsoft.NET.Sdk používaná tímto projektem nestačí pro podporu sady .NET Standard 2.0, kterou vyžadují odkazy tohoto projektu. Nainstalujte verzi 2.0 nebo vyšší sady .NET Core SDK. @@ -329,7 +329,7 @@ The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + Platforma RuntimeIdentifier a PlatformTarget se musí shodovat. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index b73d67fd9608..b583594c310b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - Die von diesem Projekt verwendete Microsoft.NET.Sdk-Version ist für die Unterstützung von .NET Standard 2.0 nicht ausreichend, was für die Verweise dieses Projekts jedoch erforderlich ist. Installieren Sie Version 2.0 oder höher des .NET Core SDK. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + Die von diesem Projekt verwendete Microsoft.NET.Sdk-Version ist für die Unterstützung von .NET Standard 2.0 nicht ausreichend, was für die Verweise dieses Projekts jedoch erforderlich ist. Installieren Sie Version 2.0 oder höher des .NET Core SDK. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + Die RuntimeIdentifier-Plattform und PlatformTarget müssen übereinstimmen. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index c553ec3ea6ac..c636e818b228 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - La versión de Microsoft.NET.Sdk que se usa en este proyecto no es suficiente para admitir .NET Standard 2.0, que es necesario para las referencias de este proyecto. Instale la versión 2.0 o superior del SDK de .NET Core. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + La versión de Microsoft.NET.Sdk que se usa en este proyecto no es suficiente para admitir .NET Standard 2.0, que es necesario para las referencias de este proyecto. Instale la versión 2.0 o superior del SDK de .NET Core. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + Las plataformas RuntimeIdentifier y PlatformTarget deben coincidir. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 1ee4331348cf..adb6d5b08182 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - La version de Microsoft.NET.Sdk utilisée par ce projet ne permet pas de prendre en charge .NET Standard 2.0, lequel est nécessaire aux références de ce projet. Installez la version 2.0 ou une version ultérieure du kit .NET Core SDK. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + La version de Microsoft.NET.Sdk utilisée par ce projet ne permet pas de prendre en charge .NET Standard 2.0, lequel est nécessaire aux références de ce projet. Installez la version 2.0 ou une version ultérieure du kit .NET Core SDK. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + La plateforme RuntimeIdentifier et la PlatformTarget doivent correspondre. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 87773b90c023..310abd270e8e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - La versione di Microsoft.NET.Sdk usata da questo progetto non è sufficiente per supportare .NET Standard 2.0 che è richiesto dai riferimenti di questo progetto. Installare la versione 2.0 o successiva di .NET Core SDK. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + La versione di Microsoft.NET.Sdk usata da questo progetto non è sufficiente per supportare .NET Standard 2.0 che è richiesto dai riferimenti di questo progetto. Installare la versione 2.0 o successiva di .NET Core SDK. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + La piattaforma di RuntimeIdentifier e quella di PlatformTarget devono corrispondere. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 9527767bbbc7..d39f6d2c413c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - このプロジェクトで使用される Microsoft.NET.Sdk のバージョンは、このプロジェクトの参照で必要な .NET Standard 2.0 をサポートするには不十分です。.NET Core SDK のバージョン 2.0 以降をインストールしてください。 + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + このプロジェクトで使用される Microsoft.NET.Sdk のバージョンは、このプロジェクトの参照で必要な .NET Standard 2.0 をサポートするには不十分です。.NET Core SDK のバージョン 2.0 以降をインストールしてください。 The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier プラットフォームと PlatformTarget は一致している必要があります。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 670749f8cf46..a11458f67983 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - 이 프로젝트에서 사용하는 Microsoft.NET.Sdk 버전이 이 프로젝트의 참조에서 필요로 하는 .NET 표준 2.0을 지원할 수 없습니다. .NET Core SDK 버전 2.0 이상을 설치하세요. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + 이 프로젝트에서 사용하는 Microsoft.NET.Sdk 버전이 이 프로젝트의 참조에서 필요로 하는 .NET 표준 2.0을 지원할 수 없습니다. .NET Core SDK 버전 2.0 이상을 설치하세요. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier 플랫폼과 PlatformTarget은 일치해야 합니다. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 824c247c044c..fd204dd4ec7d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - Używana przez ten projekt wersja zestawu Microsoft.NET.Sdk jest niewystarczająca do zapewnienia obsługi środowiska .NET Standard 2.0 wymaganego przez odwołania występujące w tym projekcie. Zainstaluj zestaw .NET Core SDK w wersji co najmniej 2.0. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + Używana przez ten projekt wersja zestawu Microsoft.NET.Sdk jest niewystarczająca do zapewnienia obsługi środowiska .NET Standard 2.0 wymaganego przez odwołania występujące w tym projekcie. Zainstaluj zestaw .NET Core SDK w wersji co najmniej 2.0. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + Platforma RuntimeIdentifier i wartość PlatformTarget muszą być zgodne. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 33091776c313..fb3ea7cfeae8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - A versão do Microsoft.NET.Sdk usado por este projeto é insuficiente para dar suporte ao .NET Standard 2.0, que é exigido pelas referências deste projeto. Instale a versão 2.0 ou superior do SDK .NET Core. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + A versão do Microsoft.NET.Sdk usado por este projeto é insuficiente para dar suporte ao .NET Standard 2.0, que é exigido pelas referências deste projeto. Instale a versão 2.0 ou superior do SDK .NET Core. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + A plataforma RuntimeIdentifier e a PlatformTarget devem corresponder. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 6c04529f019d..18e18b749026 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - Используемая для этого проекта версия Microsoft.NET.SDK недостаточна для поддержки версии .NET Standard 2.0, необходимой согласно документам по этому проекту. Установите пакет SDK для .NET Core версии 2.0 или более поздней. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + Используемая для этого проекта версия Microsoft.NET.SDK недостаточна для поддержки версии .NET Standard 2.0, необходимой согласно документам по этому проекту. Установите пакет SDK для .NET Core версии 2.0 или более поздней. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + Платформа RuntimeIdentifier и PlatformTarget должны совпадать. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index ab2d29d1d9fe..1fbb74e0573a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - Bu proje tarafından kullanılan Microsoft.NET.Sdk, proje başvurularının gerektirdiği .NET Standard 2.0’ı desteklemek için yeterli değil. Lütfen .NET Core SDK 2.0 veya sonraki bir sürümü yükleyin. + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + Bu proje tarafından kullanılan Microsoft.NET.Sdk, proje başvurularının gerektirdiği .NET Standard 2.0’ı desteklemek için yeterli değil. Lütfen .NET Core SDK 2.0 veya sonraki bir sürümü yükleyin. The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier platformu ile PlatformTarget eşleşmelidir. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index df5475e205c8..00c9fb685f07 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - 该项目使用的 Microsoft.NET.Sdk 版本不足以支持项目引用所需的 .NET Standard 2.0。请安装 2.0 版本或更高版本的 .NET Core SDK。 + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + 该项目使用的 Microsoft.NET.Sdk 版本不足以支持项目引用所需的 .NET Standard 2.0。请安装 2.0 版本或更高版本的 .NET Core SDK。 The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier 平台和 PlatformTarget 必须匹配。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 8ec038d56b3b..3a4a7a10fbe8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -323,13 +323,13 @@ - The version of Microsoft.NET.Sdk used by this project is insufficient to support .NET Standard 2.0 which is required by this project's references. Please install version 2.0 or higher of the .NET Core SDK. - 此專案所使用的 Microsoft.NET.Sdk 版本,不足以支援此專案參考所需的 .NET Standard 2.0。請安裝 NET Core SDK 2.0 版或更高版本。 + The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + 此專案所使用的 Microsoft.NET.Sdk 版本,不足以支援此專案參考所需的 .NET Standard 2.0。請安裝 NET Core SDK 2.0 版或更高版本。 The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier 平台必須與 PlatformTarget 相符。 diff --git a/src/Tasks/Common/src/ItemUtilities.cs b/src/Tasks/Common/src/ItemUtilities.cs index 551a22f9b812..ba6f0a45f9e0 100644 --- a/src/Tasks/Common/src/ItemUtilities.cs +++ b/src/Tasks/Common/src/ItemUtilities.cs @@ -116,7 +116,9 @@ public static string GetSourcePath(ITaskItem item) static readonly string[] s_targetPathMetadata = new[] { MetadataNames.TargetPath, MetadataNames.DestinationSubPath }; public static string GetTargetPath(ITaskItem item) { - // first use TargetPath, DestinationSubPath, then Path, then fallback to filename+extension alone + // first use TargetPath, then DestinationSubPath, then fallback to filename+extension alone + // Can't use Path, as this is the path of the file in the package, which is usually not the target path + // (for example the target path for lib/netcoreapp2.0/lib.dll is just lib.dll) foreach (var metadata in s_targetPathMetadata) { var value = item.GetMetadata(metadata); @@ -130,7 +132,17 @@ public static string GetTargetPath(ITaskItem item) var sourcePath = GetSourcePath(item); - return Path.GetFileName(sourcePath); + var fileName = Path.GetFileName(sourcePath); + + // Get locale subdirectory for satellite assemblies + var destinationSubDirectory = item.GetMetadata("DestinationSubDirectory"); + + if (!string.IsNullOrWhiteSpace(destinationSubDirectory)) + { + return Path.Combine(destinationSubDirectory, fileName); + } + + return fileName; } } } diff --git a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs index cec0cfb6163a..04109268f7af 100644 --- a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs +++ b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs @@ -129,6 +129,16 @@ internal static bool GetFileDependsOnNETStandard(string filePath) { assemblyImport.CloseEnum(asmRefEnum); } + + if (assemblyImport != null) + { + Marshal.ReleaseComObject(assemblyImport); + } + + if (metadataDispenser != null) + { + Marshal.ReleaseComObject(metadataDispenser); + } } } return false; diff --git a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/Microsoft.NET.Build.Extensions.Tasks.csproj b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/Microsoft.NET.Build.Extensions.Tasks.csproj index 829b05771742..965adb882422 100644 --- a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/Microsoft.NET.Build.Extensions.Tasks.csproj +++ b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/Microsoft.NET.Build.Extensions.Tasks.csproj @@ -51,19 +51,122 @@ Resources\xlf\%(FileName)%(Extension) - Resources\%(FileName)%(Extension) + Resources\Strings.resx ResXFileCodeGenerator Strings.Designer.cs Microsoft.NET.Build.Tasks - Resources\%(FileName)%(Extension) + Resources\Strings.Designer.cs True True Strings.resx + + + Common\.\\BuildErrorException.cs + + + Common\.\\DiagnosticMessageSeverity.cs + + + Common\.\\DiagnosticsHelper.cs + + + Common\.\\FileUtilities.cs + + + Common\.\\FileUtilities.net45.cs + + + Common\.\\FileUtilities.netstandard.cs + + + Common\.\\ILog.cs + + + Common\.\\ItemUtilities.cs + + + Common\.\\MSBuildLog.cs + + + Common\.\\MetadataKeys.cs + + + Common\.\\NETSdkError.cs + + + Common\.\\NuGetUtils.cs + + + Common\.\\TaskBase.cs + + + Common\ConflictResolution\\ConflictItem.cs + + + Common\ConflictResolution\\ConflictResolver.cs + + + Common\ConflictResolution\\MSBuildUtilities.cs + + + Common\ConflictResolution\\MetadataNames.cs + + + Common\ConflictResolution\\PackageRank.cs + + + Common\ConflictResolution\\PlatformManifestReader.cs + + + Common\ConflictResolution\\ResolvePackageFileConflicts.cs + + + + + Resources\xlf\Strings.cs.xlf + + + Resources\xlf\Strings.de.xlf + + + Resources\xlf\Strings.es.xlf + + + Resources\xlf\Strings.fr.xlf + + + Resources\xlf\Strings.it.xlf + + + Resources\xlf\Strings.ja.xlf + + + Resources\xlf\Strings.ko.xlf + + + Resources\xlf\Strings.pl.xlf + + + Resources\xlf\Strings.pt-BR.xlf + + + Resources\xlf\Strings.ru.xlf + + + Resources\xlf\Strings.tr.xlf + + + Resources\xlf\Strings.zh-Hans.xlf + + + Resources\xlf\Strings.zh-Hant.xlf + + <_netstandardLibraryNetFrameworkPath>$(NUGET_PACKAGES)\NETStandard.Library.NETFramework\$(NETStandardLibraryNETFrameworkVersion)\build @@ -79,8 +182,8 @@ - - + + diff --git a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.NETFramework.targets b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.NETFramework.targets index d9d8e3f6f72e..2162e3cc9b5f 100644 --- a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.NETFramework.targets +++ b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.NETFramework.targets @@ -59,15 +59,6 @@ Copyright (c) .NET Foundation. All rights reserved. - <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.7'" - Include="$(MSBuildThisFileDirectory)\net47\ref\*.dll" /> - <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.6.2'" - Include="$(MSBuildThisFileDirectory)\net462\ref\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\net462\ref\%(FileName).dll')" /> - <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.6.1'" - Include="$(MSBuildThisFileDirectory)\net461\ref\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\net461\ref\%(FileName).dll')" /> - <_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.7'" Include="$(MSBuildThisFileDirectory)\net47\lib\*.dll" /> <_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.6.2'" @@ -83,15 +74,12 @@ Copyright (c) .NET Foundation. All rights reserved. Simple references can also come from NuGet framework assemblies, hence this statement should occur after including all computed references, thus this target is scheduled after references have been raised by NuGet targets. --> - + - - false + + + false - - - false - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ConflictResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ConflictResolution.targets index 0a53a4a01d8a..db4c48112189 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ConflictResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ConflictResolution.targets @@ -32,10 +32,14 @@ Copyright (c) .NET Foundation. All rights reserved. + for conflict resolution. Set DestinationSubPath for these items so that conflict resolution will consider + that path (for example "runtimes/win/lib/netstandard1.3/System.Diagnostics.TraceSource.dll" when looking + for conflicts). --> <_RuntimeTargetItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'RuntimeTarget'))" /> <__RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(_RuntimeTargetItems)" /> <_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" /> + <_RuntimeTargetPublishItems Update="@(_RuntimeTargetPublishItems)" + DestinationSubPath="%(Path)" /> <_LockFileAssemblies Include="@(_RuntimeTargetPublishItems->WithMetadataValue('Type', 'assembly')->'%(ResolvedPath)')"> false diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets new file mode 100644 index 000000000000..a751bf29ca0d --- /dev/null +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets @@ -0,0 +1,29 @@ + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + <_NugetFallbackFolder>$(MSBuildThisFileDirectory)..\..\..\..\NuGetFallbackFolder + <_IsNETCore1x Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '2.0' ">true + + + + $(RestoreAdditionalProjectSources);$(_NugetFallbackFolder) + $(RestoreAdditionalProjectFallbackFoldersExcludes);$(_NugetFallbackFolder) + + $(RestoreAdditionalProjectFallbackFolders);$(_NugetFallbackFolder) + + \ No newline at end of file diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.BeforeCommon.targets index 22c761858892..0b7afa1afdb2 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.BeforeCommon.targets @@ -14,7 +14,6 @@ Copyright (c) .NET Foundation. All rights reserved. $(MSBuildAllProjects);$(MSBuildThisFileFullPath) <_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true - <_NugetFallbackFolder>$(MSBuildThisFileDirectory)..\..\..\..\NuGetFallbackFolder @@ -88,11 +87,11 @@ Copyright (c) .NET Foundation. All rights reserved. <_TargetFrameworkVersionWithoutV Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.Substring(1)) - - $(RestoreAdditionalProjectSources);$(_NugetFallbackFolder) - - $(RestoreAdditionalProjectFallbackFolders);$(_NugetFallbackFolder) - + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.DefaultItems.targets index 57ca8309b0a4..cebc631fcfda 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.DefaultItems.targets @@ -76,29 +76,25 @@ Copyright (c) .NET Foundation. All rights reserved. If RuntimeFrameworkVersion is not specified, the following logic applies: - - When targeting .NET Core 2.0 or higher, Framework-dependent apps use the target framework version with a ".0" patch version - - When targeting .NET Core 2.0 or higher, Self-contained apps use the latest patch version (from when the SDK shipped) for - the specified major.minor version of .NET Core - - When targeting .NET Core 1.x, the latest patch version (from when the SDK shipped) is used for both Framework-dependent and - Self-contained apps. This is to preserve the same behavior between 1.x and 2.0 SDKs. If we ship further patch versions - after 1.0.5 and 1.1.2, we may choose to apply the Framework-dependent / Self-contained split to 1.x for those versions. + - Self-contained apps use the latest corrsesponding patch version (from when the SDK shipped) + + - When targeting .NET Core 2.0 or higher: + - Framework-dependent apps use the target framework version with a ".0" patch version + + - When targeting .NET Core 1.0 and 1.1 + - Framework-dependent apps use 1.0.5 and 1.1.2, respectively. + - This is done for compatibility with previous releases that bumped the self-contained and framework-dependent versions together. --> - + - 1.0.5 1.0.5 - 1.1.2 1.1.2 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)' == ''">1.1.2 + 2.0.0 @@ -108,18 +104,24 @@ Copyright (c) .NET Foundation. All rights reserved. - $(ImplicitRuntimeFrameworkVersionForFrameworkDependentNetCoreApp1_0) + 1.0.5 $(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0) - $(ImplicitRuntimeFrameworkVersionForFrameworkDependentNetCoreApp1_1) + 1.1.2 $(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1) + + + 2.0 + $(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0) + + - + $(BundledNETCoreAppPackageVersion) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.TargetFrameworkInference.targets index 6db5a64647a9..44cf94eaffc1 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.TargetFrameworkInference.targets @@ -102,6 +102,10 @@ Copyright (c) .NET Foundation. All rights reserved. FormatArguments="$([MSBuild]::Escape('$(TargetFramework)'))" /> + + + + <_ResourceFileItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'ResourceAssembly'))" /> <__ResourceCopyLocalItems Include="@(FileDefinitions)" Exclude="@(_ResourceFileItems)" /> + + <_ResourceCopyLocalItems Include="@(FileDefinitions)" Exclude="@(__ResourceCopyLocalItems)" /> - + <_ResourceCopyLocalItems Update="@(_ResourceCopyLocalItems)" Condition="'@(_ResourceCopyLocalItems)' != ''"> + $([System.IO.Directory]::GetParent(%(ResolvedPath)).get_Name())\ + + + %(_ResourceCopyLocalItems.DestinationSubDirectory) + <_AllCopyLocalItems Include="@(_NativeCopyLocalItems);@(_RuntimeCopyLocalItems);@(_ResourceCopyLocalItems)" /> @@ -548,10 +560,7 @@ Copyright (c) .NET Foundation. All rights reserved. - - - $([System.IO.Directory]::GetParent(%(ResourceCopyLocalItems.FullPath)).get_Name())\ - + diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs index 44b6e9a3504c..7909324e097c 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs @@ -415,7 +415,7 @@ public void It_does_not_report_conflicts_if_the_same_framework_assembly_is_refer var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); buildCommand - .Execute("/v:diag") + .Execute("/v:normal") .Should() .Pass() .And @@ -455,13 +455,56 @@ public void It_does_not_report_conflicts_when_referencing_a_nuget_package() var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); buildCommand - .Execute("/v:diag") + .Execute("/v:normal") .Should() .Pass() .And .NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase); } + [WindowsOnlyFact] + public void It_does_not_report_conflicts_with_runtime_specific_items() + { + var testProject = new TestProject() + { + Name = "DesktopConflictsRuntimeTargets", + TargetFrameworks = "net461", + IsSdkProject = true, + IsExe = true + }; + + testProject.AdditionalProperties["PlatformTarget"] = "AnyCPU"; + + var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name) + .WithProjectChanges(p => + { + var ns = p.Root.Name.Namespace; + var itemGroup = new XElement(ns + "ItemGroup"); + p.Root.Add(itemGroup); + + itemGroup.Add(new XElement(ns + "PackageReference", + new XAttribute("Include", "System.Security.Cryptography.Algorithms"), + new XAttribute("Version", "4.3.0"))); + }) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + var buildResult = buildCommand + .Execute("/v:normal"); + + buildResult.Should().Pass(); + + // Correct asset should be copied to output folder. Before fixing https://github.com/dotnet/sdk/issues/1510, + // the runtimeTargets items would win conflict resolution, and then would not be copied to the output folder, + // so there'd be no copy of the DLL in the output folder. + var outputDirectory = buildCommand.GetOutputDirectory(testProject.TargetFrameworks); + outputDirectory.Should().HaveFile("System.Security.Cryptography.Algorithms.dll"); + + // There should be no conflicts + buildResult.Should().NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase); + } + [Fact] public void It_generates_binding_redirects_if_needed() { @@ -495,31 +538,42 @@ public void It_generates_binding_redirects_if_needed() [InlineData(false)] public void It_places_package_satellites_correctly(bool crossTarget) { - var testAsset = _testAssetsManager - .CopyTestAsset( - "DesktopUsingPackageWithSatellites", - identifier: crossTarget ? "_cross" : "") - .WithSource(); + var testProject = new TestProject() + { + Name = "DesktopUsingPackageWithSatellites", + TargetFrameworks = "net46", + IsSdkProject = true, + IsExe = true + }; if (crossTarget) { - testAsset = testAsset.WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Element(ns + "TargetFramework").Name += "s"; - }); + testProject.Name += "_cross"; } - testAsset.Restore(Log); + testProject.PackageReferences.Add(new TestPackageReference("FluentValidation", "5.5.0")); - var buildCommand = new BuildCommand(Log, testAsset.TestRoot); + var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name) + .WithProjectChanges(project => + { + if (crossTarget) + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Element(ns + "TargetFramework").Name += "s"; + } + }) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); buildCommand - .Execute() + .Execute("/v:normal") .Should() - .Pass(); + .Pass() + .And + .NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase); - var outputDirectory = buildCommand.GetOutputDirectory("net46"); + var outputDirectory = buildCommand.GetOutputDirectory(testProject.TargetFrameworks); outputDirectory.Should().NotHaveFile("FluentValidation.resources.dll"); outputDirectory.Should().HaveFile(@"fr\FluentValidation.resources.dll"); } diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs index 7b8c17a8e245..37d09f36166a 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs @@ -287,7 +287,7 @@ public void It_does_not_include_netstandard_when_inbox(bool isSdk) // Add a target that replaces the facade folder with the set of netstandard support assemblies // this can be replaced by targeting the version of .NETFramework that includes netstandard inbox, // once available - var facadesDir = Path.Combine(RepoInfo.BuildExtensionsMSBuildPath, "net461", "ref\\"); + var facadesDir = Path.Combine(RepoInfo.BuildExtensionsMSBuildPath, "net461", "lib\\"); var ns = project.Root.Name.Namespace; var target = new XElement(ns + "Target", new XAttribute("Name", "ReplaceDesignTimeFacadeDirectories"), diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index c7f51e9b1675..91795f46a912 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -48,15 +48,20 @@ public void It_targets_the_right_shared_framework(string targetFramework, string // Test behavior when implicit version differs for framework-dependent and self-contained apps [Theory] - [InlineData(false, true, "1.1.1")] - [InlineData(true, true, "1.1.2")] - [InlineData(false, false, "1.1.1")] - public void It_targets_the_right_framework_depending_on_output_type(bool selfContained, bool isExe, string expectedFrameworkVersion) + [InlineData("netcoreapp1.0", false, true, "1.0.5")] + [InlineData("netcoreapp1.0", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0)] + [InlineData("netcoreapp1.0", false, false, "1.0.5")] + [InlineData("netcoreapp1.1", false, true, "1.1.2")] + [InlineData("netcoreapp1.1", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)] + [InlineData("netcoreapp1.1", false, false, "1.1.2")] + [InlineData("netcoreapp2.0", false, true, "2.0.0")] + [InlineData("netcoreapp2.0", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0)] + [InlineData("netcoreapp2.0", false, false, "2.0.0")] + public void It_targets_the_right_framework_depending_on_output_type(string targetFramework, bool selfContained, bool isExe, string expectedFrameworkVersion) { string testIdentifier = "Framework_targeting_" + (isExe ? "App_" : "Lib_") + (selfContained ? "SelfContained" : "FrameworkDependent"); - It_targets_the_right_framework(testIdentifier, "netcoreapp1.1", null, selfContained, isExe, expectedFrameworkVersion, expectedFrameworkVersion, - "/p:ImplicitRuntimeFrameworkVersionForFrameworkDependentNetCoreApp1_1=1.1.1"); + It_targets_the_right_framework(testIdentifier, targetFramework, null, selfContained, isExe, expectedFrameworkVersion, expectedFrameworkVersion); } private void It_targets_the_right_framework( @@ -312,6 +317,77 @@ public static void Main() } } + [Fact] + public void There_are_no_conflicts_when_targeting_netcoreapp_1_1() + { + var testProject = new TestProject() + { + Name = "NetCoreApp1.1_Conflicts", + TargetFrameworks = "netcoreapp1.1", + IsSdkProject = true, + IsExe = true + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute("/v:normal") + .Should() + .Pass() + .And + .NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void It_publishes_package_satellites_correctly(bool crossTarget) + { + var testProject = new TestProject() + { + Name = "AppUsingPackageWithSatellites", + TargetFrameworks = "netcoreapp2.0", + IsSdkProject = true, + IsExe = true + }; + + if (crossTarget) + { + testProject.Name += "_cross"; + } + + testProject.PackageReferences.Add(new TestPackageReference("Humanizer.Core.fr", "2.2.0")); + testProject.PackageReferences.Add(new TestPackageReference("Humanizer.Core.pt", "2.2.0")); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name) + .WithProjectChanges(project => + { + if (crossTarget) + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Element(ns + "TargetFramework").Name += "s"; + } + }) + .Restore(Log, testProject.Name); + + var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + publishCommand + .Execute("/v:normal", $"/p:TargetFramework={testProject.TargetFrameworks}") + .Should() + .Pass() + .And + .NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ; + + var outputDirectory = publishCommand.GetOutputDirectory(testProject.TargetFrameworks); + outputDirectory.Should().NotHaveFile("Humanizer.resources.dll"); + outputDirectory.Should().HaveFile(Path.Combine("fr", "Humanizer.resources.dll")); + } + [Fact] public void It_uses_lowercase_form_of_the_target_framework_for_the_output_path() { diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreAppForTelemetry.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreAppForTelemetry.cs new file mode 100644 index 000000000000..e0b4c3d2bc6a --- /dev/null +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreAppForTelemetry.cs @@ -0,0 +1,75 @@ +using FluentAssertions; +using Microsoft.NET.TestFramework; +using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Commands; +using Microsoft.NET.TestFramework.ProjectConstruction; +using System; +using System.IO; +using Xunit; +using Xunit.Abstractions; +using System.Reflection; + +namespace Microsoft.NET.Build.Tests +{ + public class GivenThatWeWantToBuildANetCoreAppAndPassingALogger : SdkTest + { + public GivenThatWeWantToBuildANetCoreAppAndPassingALogger(ITestOutputHelper log) : base(log) + { + } + + [CoreMSBuildOnlyFact] + public void It_collects_TargetFramework_version() + { + string targetFramework = "netcoreapp1.0"; + var testProject = new TestProject() + { + Name = "FrameworkTargetTelemetryTest", + TargetFrameworks = targetFramework, + IsSdkProject = true, + }; + Type loggerType = typeof(LogTelemetryToStdOutForTest); + var TelemetryTestLogger = new[] + { + $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" + }; + var testAsset = _testAssetsManager.CreateTestProject(testProject) + .Restore(Log, testProject.Name, TelemetryTestLogger); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute(TelemetryTestLogger) + .StdOut.Should() + .Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETCoreApp,Version=v1.0\"}"); + } + + [CoreMSBuildOnlyFact] + public void It_collects_multi_TargetFramework_version() + { + string targetFramework = "net46;netcoreapp1.1"; + + var testProject = new TestProject() + { + Name = "MultitargetTelemetry", + TargetFrameworks = targetFramework, + IsSdkProject = true, + }; + Type loggerType = typeof(LogTelemetryToStdOutForTest); + var TelemetryTestLogger = new[] + { + $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" + }; + var testAsset = _testAssetsManager.CreateTestProject(testProject) + .Restore(Log, testProject.Name, TelemetryTestLogger); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute(TelemetryTestLogger) + .StdOut.Should() + .Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETFramework,Version=v4.6\"}") + .And + .Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETCoreApp,Version=v1.1\"}"); + } + } +} diff --git a/test/Microsoft.NET.Build.Tests/LogTelemetryToStdOutForTest.cs b/test/Microsoft.NET.Build.Tests/LogTelemetryToStdOutForTest.cs new file mode 100644 index 000000000000..d70443b33d80 --- /dev/null +++ b/test/Microsoft.NET.Build.Tests/LogTelemetryToStdOutForTest.cs @@ -0,0 +1,31 @@ +// 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 Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using NuGet.Protocol; + +namespace Microsoft.NET.Build.Tests +{ + public sealed class LogTelemetryToStdOutForTest : Logger + { + + public LogTelemetryToStdOutForTest() + { + } + + public override void Initialize(IEventSource eventSource) + { + if (eventSource is IEventSource2 eventSource2) + { + eventSource2.TelemetryLogged += OnTelemetryLogged; + } + } + + private void OnTelemetryLogged(object sender, TelemetryEventArgs args) + { + Console.WriteLine(args.ToJson()); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs index 30c98e2d2395..de38859869d2 100644 --- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs +++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs @@ -24,18 +24,22 @@ public GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties(ITestOutputHel // https://github.com/dotnet/sdk/issues/1327 [CoreMSBuildOnlyTheory] - [InlineData("netstandard1.3", "1.3", true)] + [InlineData("netstandard1.3", "1.3", false)] [InlineData("netcoreapp1.0", "1.0", true)] [InlineData("netcoreapp1.1", "1.1", true)] [InlineData("netstandard2.0", "2.0", false)] [InlineData("netcoreapp2.0", "2.0app", false)] + [InlineData("net461", "461app", false)] + [InlineData("netcoreapp2.0;net461", "multiTFM20app", false)] + [InlineData("netcoreapp1.0;netcoreapp2.0", "multiTFM1020app", true)] + [InlineData("netcoreapp1.0;net461", "multiTFM1046app", true)] public void I_can_restore_a_project_with_implicit_msbuild_nuget_config( - string framework, + string frameworks, string projectPrefix, bool fileExists) { string testProjectName = $"{projectPrefix}Fallback"; - TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, framework); + TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks); var packagesFolder = Path.Combine(RepoInfo.TestsFolder, "packages", testProjectName); @@ -56,16 +60,16 @@ public void I_can_restore_a_project_with_implicit_msbuild_nuget_config( [InlineData("netcoreapp1.1", "1.1")] [InlineData("netstandard2.0", "2.0")] [InlineData("netcoreapp2.0", "2.0app")] - public void I_can_disable_implicit_msbuild_nuget_config(string framework, string projectPrefix) + public void I_can_disable_implicit_msbuild_nuget_config(string frameworks, string projectPrefix) { string testProjectName = $"{projectPrefix}DisabledFallback"; - TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, framework); + TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks); var restoreCommand = testProjectTestAsset.GetRestoreCommand(Log, relativePath: testProjectName); restoreCommand.Execute($"/p:DisableImplicitNuGetFallbackFolder=true").Should().Fail(); } - private TestAsset CreateTestAsset(string testProjectName, string framework) + private TestAsset CreateTestAsset(string testProjectName, string frameworks) { var packageInNuGetFallbackFolder = CreatePackageInNuGetFallbackFolder(); @@ -73,7 +77,7 @@ private TestAsset CreateTestAsset(string testProjectName, string framework) new TestProject { Name = testProjectName, - TargetFrameworks = framework, + TargetFrameworks = frameworks, IsSdkProject = true }; diff --git a/test/Microsoft.NET.TestFramework/Commands/PackCommand.cs b/test/Microsoft.NET.TestFramework/Commands/PackCommand.cs index 1f16c865d52d..70d2b149c98d 100644 --- a/test/Microsoft.NET.TestFramework/Commands/PackCommand.cs +++ b/test/Microsoft.NET.TestFramework/Commands/PackCommand.cs @@ -16,14 +16,14 @@ public PackCommand(ITestOutputHelper log, string projectPath, string relativePat { } - public string GetIntermediateNuspecPath(string packageId = null, string packageVersion = "1.0.0") + public string GetIntermediateNuspecPath(string packageId = null, string configuration = "Debug", string packageVersion = "1.0.0") { if (packageId == null) { packageId = Path.GetFileNameWithoutExtension(ProjectFile); } - return Path.Combine(GetBaseIntermediateDirectory().FullName, $"{packageId}.{packageVersion}.nuspec"); + return Path.Combine(GetBaseIntermediateDirectory().FullName, configuration, $"{packageId}.{packageVersion}.nuspec"); } } } diff --git a/test/Microsoft.NET.TestFramework/RepoInfo.cs b/test/Microsoft.NET.TestFramework/RepoInfo.cs index 21e7f81972c1..44d218ae8975 100644 --- a/test/Microsoft.NET.TestFramework/RepoInfo.cs +++ b/test/Microsoft.NET.TestFramework/RepoInfo.cs @@ -134,6 +134,15 @@ private static string FindConfigurationInBasePath() return new DirectoryInfo(GetBaseDirectory()).Parent.Name; } + // For test purposes, override the implicit .NETCoreApp version for self-contained apps that to builds thare + // (1) different from the fixed framework-dependent defaults (1.0.5, 1.1.2, 2.0.0) + // (2) currently available on nuget.org + // + // This allows bumping the versions before builds without causing tests to fail. + public const string ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0 = "1.0.4"; + public const string ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1 = "1.1.1"; + public const string ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0 = "2.0.0-preview2-25407-01"; + public static string GetBaseDirectory() { #if NET451 @@ -150,6 +159,8 @@ public static ICommand AddTestEnvironmentVariables(ICommand command) // Set NUGET_PACKAGES environment variable to match value from build.ps1 command = command.EnvironmentVariable("NUGET_PACKAGES", RepoInfo.NuGetCachePath); + command = command.EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0"); + command = command.EnvironmentVariable("MSBuildSDKsPath", RepoInfo.SdksPath); command = command.EnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR", RepoInfo.SdksPath); @@ -160,6 +171,11 @@ public static ICommand AddTestEnvironmentVariables(ICommand command) "msbuildExtensions-ver", "Microsoft.Common.targets", "ImportAfter", "Microsoft.NET.Build.Extensions.targets")); command = command.EnvironmentVariable("MicrosoftNETBuildExtensionsTargets", Path.Combine(RepoInfo.BuildExtensionsMSBuildPath, "Microsoft.NET.Build.Extensions.targets")); + command = command + .EnvironmentVariable(nameof(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0), ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0) + .EnvironmentVariable(nameof(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1), ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1) + .EnvironmentVariable(nameof(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0), ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0); + return command; } } diff --git a/test/Microsoft.NET.TestFramework/TestPackageReference.cs b/test/Microsoft.NET.TestFramework/TestPackageReference.cs index 3f1185307a9a..3f695f9887cc 100644 --- a/test/Microsoft.NET.TestFramework/TestPackageReference.cs +++ b/test/Microsoft.NET.TestFramework/TestPackageReference.cs @@ -11,6 +11,11 @@ namespace Microsoft.NET.TestFramework { public class TestPackageReference { + public TestPackageReference(string id, string version) + : this(id, version, null) + { + } + public TestPackageReference(string id, string version, string nupkgPath) { ID = id;