From 2d96a13798d2fde676ea292ba8efe0d778a3a7f6 Mon Sep 17 00:00:00 2001 From: NuGet Team Bot Date: Sun, 23 Jul 2017 16:23:54 -0700 Subject: [PATCH 01/34] Insert NuGet Build 4.3.0-rtm-4324 into sdk --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 2f9ca33395f7..0e7856594374 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,7 +10,7 @@ 15.2.0-preview-000093-02 2.0.0-preview1-001960 2.0.0-preview1-001960 - 4.3.0-rtm-4315 + 4.3.0-rtm-4324 9.0.1 1.4.2 2.0.0-preview2-25405-01 From b9d2904a3d203afcaeb24810488d82518f2bd217 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 7 Jul 2017 13:18:23 -0700 Subject: [PATCH 02/34] Adds fallback folder for full framework projects. Setting RestoreAdditionalProjectFallbackFoldersExcludes when the TFM is 1.x to prevent fallback folders from being used in that case. Note that NuGet will have to do the aggregation of these properties in order for this to work. --- .../Microsoft.NET.NuGetOfflineCache.targets | 29 +++++++++++++++++++ .../Microsoft.NET.Sdk.BeforeCommon.targets | 11 ++++--- ...storeProjectsUsingNuGetConfigProperties.cs | 16 ++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets 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..6506c26a5eed --- /dev/null +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets @@ -0,0 +1,29 @@ + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + <_NugetFallbackFolder>$(MSBuildThisFileDirectory)..\..\..\..\NuGetFallbackFolder + <_IsNETCoreOrNETStandard1x Condition=" '$(_IsNETCoreOrNETStandard)' == 'true' 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 bb8178b88fde..d00810bdbc4f 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/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs index 30c98e2d2395..5f587953572e 100644 --- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs +++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs @@ -29,13 +29,17 @@ public GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties(ITestOutputHel [InlineData("netcoreapp1.1", "1.1", true)] [InlineData("netstandard2.0", "2.0", false)] [InlineData("netcoreapp2.0", "2.0app", false)] + [InlineData("net461", "461app", false)] + // https://github.com/NuGet/Home/issues/5596 and https://github.com/dotnet/project-system/issues/2605 + //[InlineData("netcoreapp2.0;net461", "multiTFM20app", false)] + //[InlineData("netcoreapp1.0;netcoreapp2.0", "multiTFM1020app", 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 }; From 2a7fdf2a52acee24f4d215a2a68d3ada49123679 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 24 Jul 2017 15:26:29 -0700 Subject: [PATCH 03/34] Changing the condition to not use fallback folder to trigger only on netcoreapp. --- .../build/Microsoft.NET.NuGetOfflineCache.targets | 8 ++++---- ...atWeWantToRestoreProjectsUsingNuGetConfigProperties.cs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) 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 index 6506c26a5eed..a751bf29ca0d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.NuGetOfflineCache.targets @@ -17,13 +17,13 @@ Copyright (c) .NET Foundation. All rights reserved. <_NugetFallbackFolder>$(MSBuildThisFileDirectory)..\..\..\..\NuGetFallbackFolder - <_IsNETCoreOrNETStandard1x Condition=" '$(_IsNETCoreOrNETStandard)' == 'true' and '$(_TargetFrameworkVersionWithoutV)' < '2.0' ">true + <_IsNETCore1x Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '2.0' ">true - $(RestoreAdditionalProjectSources);$(_NugetFallbackFolder) - $(RestoreAdditionalProjectFallbackFoldersExcludes);$(_NugetFallbackFolder) + $(RestoreAdditionalProjectSources);$(_NugetFallbackFolder) + $(RestoreAdditionalProjectFallbackFoldersExcludes);$(_NugetFallbackFolder) - $(RestoreAdditionalProjectFallbackFolders);$(_NugetFallbackFolder) + $(RestoreAdditionalProjectFallbackFolders);$(_NugetFallbackFolder) \ 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 5f587953572e..5717c737b30f 100644 --- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs +++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs @@ -24,7 +24,7 @@ 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)] @@ -33,6 +33,7 @@ public GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties(ITestOutputHel // https://github.com/NuGet/Home/issues/5596 and https://github.com/dotnet/project-system/issues/2605 //[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 frameworks, string projectPrefix, From f59804dfffd9ad6b0b959a5d6f78de95adf2f30e Mon Sep 17 00:00:00 2001 From: "Eric St. John" Date: Tue, 25 Jul 2017 16:10:48 -0700 Subject: [PATCH 04/34] Free metadata reader and assembly after reading metadata --- .../GetDependsOnNETStandard.net46.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; From ac3c196d96d376256260bb36d78e4a29f0c87599 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 25 Jul 2017 17:59:33 -0700 Subject: [PATCH 05/34] Re-enable tests and update the CLI to the one containing the new NuGet version that we need. --- DotnetCLIVersion.txt | 2 +- ...hatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 72d6b048e510..8f94aacbbc96 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.0.0-preview3-006805 \ No newline at end of file +2.0.0-preview3-006847 \ 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 5717c737b30f..de38859869d2 100644 --- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs +++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs @@ -30,10 +30,9 @@ public GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties(ITestOutputHel [InlineData("netstandard2.0", "2.0", false)] [InlineData("netcoreapp2.0", "2.0app", false)] [InlineData("net461", "461app", false)] - // https://github.com/NuGet/Home/issues/5596 and https://github.com/dotnet/project-system/issues/2605 - //[InlineData("netcoreapp2.0;net461", "multiTFM20app", false)] - //[InlineData("netcoreapp1.0;netcoreapp2.0", "multiTFM1020app", true)] - //[InlineData("netcoreapp1.0;net461", "multiTFM1046app", true)] + [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 frameworks, string projectPrefix, From ea0642985f2251e275b067ff099524bcf9f39744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Wed, 26 Jul 2017 09:43:11 +0200 Subject: [PATCH 06/34] LOC CHECKIN | sdk-release/2.0.0 | 20170726 --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 31db50aa987b..e267a74bd7dc 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -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..8da6739fd72f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -329,7 +329,7 @@ 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..f12c1ea0ce99 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -329,7 +329,7 @@ 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..db0135cc7cab 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -329,7 +329,7 @@ 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..910f9c018df0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -329,7 +329,7 @@ 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..747500f2e2fc 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -329,7 +329,7 @@ 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..14318b3a04c4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -329,7 +329,7 @@ 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..b4d1f293307f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -329,7 +329,7 @@ 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..3412ab963872 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -329,7 +329,7 @@ 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..7ad6f58422d1 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -329,7 +329,7 @@ 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..f27ebf917551 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -329,7 +329,7 @@ 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..2c93789a00a9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -329,7 +329,7 @@ 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..1fe5cbdcb50d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -329,7 +329,7 @@ The RuntimeIdentifier platform and the PlatformTarget must match. - The RuntimeIdentifier platform and the PlatformTarget must match. + RuntimeIdentifier 平台必須與 PlatformTarget 相符。 From f078aca50e817eb4b7ea8ecc3e16bb1fb950d347 Mon Sep 17 00:00:00 2001 From: William Li Date: Thu, 1 Jun 2017 14:19:53 -0700 Subject: [PATCH 07/34] Add telemetry data points for .NET Core 2.0 --- ...osoft.NET.TargetFrameworkInference.targets | 4 + ...hatWeWantToBuildANetCoreAppForTelemetry.cs | 75 +++++++++++++++++++ .../LogTelemetryToStdOutForTest.cs | 31 ++++++++ 3 files changed, 110 insertions(+) create mode 100644 test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreAppForTelemetry.cs create mode 100644 test/Microsoft.NET.Build.Tests/LogTelemetryToStdOutForTest.cs 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 1d679e53d79f..efebdcf0fb35 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)'))" /> + + + + - 2.0.0 + 2.0.1 20170101 - preview3 + servicing $(BUILD_BUILDNUMBER) 00000001-01 From 6c5891888217f4a609b47d434f51100f779706f9 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 16 Aug 2017 15:19:36 -0700 Subject: [PATCH 12/34] Update version to 2.0.2-vspre --- Common.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Common.props b/Common.props index c8c7f85d3404..6b6d226ca5d1 100644 --- a/Common.props +++ b/Common.props @@ -27,9 +27,9 @@ - 2.0.1 - 20170101 - servicing + 2.0.2 + 20170801 + vspre $(BUILD_BUILDNUMBER) 00000001-01 From df2abd257f3e6794b9a93cc774aebb1dbb0b79a0 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 16 Aug 2017 17:47:02 -0700 Subject: [PATCH 13/34] Insert NuGet Build 4.4.0-preview1-4365 and corresponding CLI version into SDK --- DotnetCLIVersion.txt | 2 +- build/DependencyVersions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index d945e9ed4891..3def9297a559 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.0.0-preview3-006920 +2.0.2-vspre-006933 diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 2a8238d766d3..35507b8743d7 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,7 +10,7 @@ 15.2.0-preview-000093-02 2.0.0-preview1-001960 2.0.0-preview1-001960 - 4.3.0-rtm-4382 + 4.4.0-preview1-4365 9.0.1 1.4.2 2.0.0-preview2-25405-01 From b38114b9b3280131c283f7985a2f4c2dd953e8b8 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 16 Aug 2017 17:50:11 -0700 Subject: [PATCH 14/34] Revert "Update version to 2.0.2-vspre" --- Common.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Common.props b/Common.props index 6b6d226ca5d1..c8c7f85d3404 100644 --- a/Common.props +++ b/Common.props @@ -27,9 +27,9 @@ - 2.0.2 - 20170801 - vspre + 2.0.1 + 20170101 + servicing $(BUILD_BUILDNUMBER) 00000001-01 From 44819532eaf5103e5ee0ef06884572555a64b54a Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 16 Aug 2017 17:41:16 -0700 Subject: [PATCH 15/34] Disable multilevel lookup in build/test to prevent accidental machine dependencies --- build.ps1 | 3 +++ build.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/build.ps1 b/build.ps1 index 9b5e5fdb91cd..80dd415986a4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -94,6 +94,9 @@ $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" # Disable first run since we want to control all package sources $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +# Don't resolve runtime, shared framework, or SDK from other locations +$env:DOTNET_MULTILEVEL_LOOKUP=0 + $logPath = "$RepoRoot\bin\log" if (!(Test-Path -Path $logPath)) { New-Item -Path $logPath -Force -ItemType 'Directory' | Out-Null diff --git a/build.sh b/build.sh index b41a16fedd38..7413eac8be56 100755 --- a/build.sh +++ b/build.sh @@ -92,4 +92,7 @@ export PATH="$DOTNET_INSTALL_DIR:$PATH" # Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +# Don't resolve runtime, shared framework, or SDK from global locations +export DOTNET_MULTILEVEL_LOOKUP=0 + dotnet msbuild $REPOROOT/build/build.proj /m:1 /nologo /p:Configuration=$CONFIGURATION /p:Platform="$PLATFORM" "${args[@]}" /warnaserror From f8d2186f3c48e63add882a7b240cced9d70cb160 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Fri, 18 Aug 2017 10:40:50 -0700 Subject: [PATCH 16/34] Bump default versions for self-contained apps --- .../Microsoft.NET.Sdk.DefaultItems.targets | 44 ++++++++++--------- .../GivenThatWeWantToBuildANetCoreApp.cs | 17 ++++--- test/Microsoft.NET.TestFramework/RepoInfo.cs | 14 ++++++ 3 files changed, 48 insertions(+), 27 deletions(-) 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..e15602e87a6f 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 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0)' == ''">1.0.6 1.1.2 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)' == ''">1.1.3 + 2.0.1 @@ -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/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index c7f51e9b1675..469b214eeece 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( diff --git a/test/Microsoft.NET.TestFramework/RepoInfo.cs b/test/Microsoft.NET.TestFramework/RepoInfo.cs index 21e7f81972c1..69b190018b96 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 @@ -160,6 +169,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; } } From 2debd7b1a8429936405e9d92f0342aebc929b277 Mon Sep 17 00:00:00 2001 From: NuGet Team Bot Date: Tue, 22 Aug 2017 16:55:51 -0700 Subject: [PATCH 17/34] Insert NuGet Build 4.4.0-preview1-4434 into sdk --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 35507b8743d7..6675e3ea8e32 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,7 +10,7 @@ 15.2.0-preview-000093-02 2.0.0-preview1-001960 2.0.0-preview1-001960 - 4.4.0-preview1-4365 + 4.4.0-preview1-4434 9.0.1 1.4.2 2.0.0-preview2-25405-01 From 623b546ccff3321f5c727f498d8d88b24b8d6caf Mon Sep 17 00:00:00 2001 From: "Rohit Agrawal (NUGET)" Date: Thu, 24 Aug 2017 10:30:51 -0700 Subject: [PATCH 18/34] fix intermediate nuspec path --- test/Microsoft.NET.TestFramework/Commands/PackCommand.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"); } } } From 7fdfc89800facb69afd7addec94a7fdf53538d78 Mon Sep 17 00:00:00 2001 From: William Li Date: Fri, 25 Aug 2017 09:37:25 -0700 Subject: [PATCH 19/34] Update DotnetCLIVersion --- DotnetCLIVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 3def9297a559..a39371d06e9a 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.0.2-vspre-006933 +2.0.2-vspre-006938 From 5e8546b34ae4a27f32d47320b35261c3d5fe5bb7 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Fri, 8 Sep 2017 16:16:13 -0700 Subject: [PATCH 20/34] Revert self-contained implicit versions to 1.0.5/1.1.2/2.0.0 --- .../build/Microsoft.NET.Sdk.DefaultItems.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e15602e87a6f..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 @@ -90,11 +90,11 @@ Copyright (c) .NET Foundation. All rights reserved. builds are available. --> 1.0.6 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0)' == ''">1.0.5 1.1.3 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)' == ''">1.1.2 2.0.1 + Condition="'$(ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0)' == ''">2.0.0 From 2df15b557b473b5c82329dcdfa5b294d866b9f60 Mon Sep 17 00:00:00 2001 From: "Eric St. John" Date: Tue, 12 Sep 2017 16:18:36 -0700 Subject: [PATCH 21/34] Update support libraries to those that are only lib. --- build/DependencyVersions.props | 2 +- ....NET.Build.Extensions.NETFramework.targets | 20 ++++--------------- ...antToBuildADesktopExeWtihNetStandardLib.cs | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 6675e3ea8e32..968e46c2cf4b 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -13,7 +13,7 @@ 4.4.0-preview1-4434 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/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/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"), From e0c9b2787ae4c9d55fefedc19218da69f4e387c6 Mon Sep 17 00:00:00 2001 From: NuGet Team Bot Date: Wed, 13 Sep 2017 17:27:51 -0700 Subject: [PATCH 22/34] Insert NuGet Build 4.4.0-preview3-4475 into sdk --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 6675e3ea8e32..b6b195e44d97 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,7 +10,7 @@ 15.2.0-preview-000093-02 2.0.0-preview1-001960 2.0.0-preview1-001960 - 4.4.0-preview1-4434 + 4.4.0-preview3-4475 9.0.1 1.4.2 2.0.0-preview2-25405-01 From 187bc2024f4a07faf577630324ff545876ab3275 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 16 Aug 2017 17:41:16 -0700 Subject: [PATCH 23/34] Disable multilevel lookup in build/test to prevent accidental machine dependencies --- build.ps1 | 3 +++ build.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/build.ps1 b/build.ps1 index 9b5e5fdb91cd..80dd415986a4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -94,6 +94,9 @@ $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" # Disable first run since we want to control all package sources $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +# Don't resolve runtime, shared framework, or SDK from other locations +$env:DOTNET_MULTILEVEL_LOOKUP=0 + $logPath = "$RepoRoot\bin\log" if (!(Test-Path -Path $logPath)) { New-Item -Path $logPath -Force -ItemType 'Directory' | Out-Null diff --git a/build.sh b/build.sh index b41a16fedd38..7413eac8be56 100755 --- a/build.sh +++ b/build.sh @@ -92,4 +92,7 @@ export PATH="$DOTNET_INSTALL_DIR:$PATH" # Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +# Don't resolve runtime, shared framework, or SDK from global locations +export DOTNET_MULTILEVEL_LOOKUP=0 + dotnet msbuild $REPOROOT/build/build.proj /m:1 /nologo /p:Configuration=$CONFIGURATION /p:Platform="$PLATFORM" "${args[@]}" /warnaserror From 82888a04ed300bbc6bcb1ffaf57fb7af011ca731 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 5 Sep 2017 19:47:42 -0700 Subject: [PATCH 24/34] Disable multilevel lookup for Tests This is already set in the build script, but setting it here will apply to scenarios such as running tests from VS --- test/Microsoft.NET.TestFramework/RepoInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Microsoft.NET.TestFramework/RepoInfo.cs b/test/Microsoft.NET.TestFramework/RepoInfo.cs index 21e7f81972c1..42342d21b9bd 100644 --- a/test/Microsoft.NET.TestFramework/RepoInfo.cs +++ b/test/Microsoft.NET.TestFramework/RepoInfo.cs @@ -150,6 +150,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); From 28102a061ddbb2a5b4161cd7dacc5f04804b6319 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 5 Sep 2017 19:49:27 -0700 Subject: [PATCH 25/34] Use correct target path for runtimeTargets items when resolving conflicts Fixes #1510 --- src/Tasks/Common/src/ItemUtilities.cs | 4 +- .../Microsoft.NET.ConflictResolution.targets | 8 +++- .../GivenThatWeWantToBuildADesktopExe.cs | 44 +++++++++++++++++++ .../GivenThatWeWantToBuildANetCoreApp.cs | 24 ++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) diff --git a/src/Tasks/Common/src/ItemUtilities.cs b/src/Tasks/Common/src/ItemUtilities.cs index 551a22f9b812..e776c6d3f8df 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); 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..83b5534f54bf 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 Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" + DestinationSubPath="%(FileDefinitions.Path)" + /> <_LockFileAssemblies Include="@(_RuntimeTargetPublishItems->WithMetadataValue('Type', 'assembly')->'%(ResolvedPath)')"> false diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs index 44b6e9a3504c..8b605a6ad01d 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs @@ -462,6 +462,50 @@ public void It_does_not_report_conflicts_when_referencing_a_nuget_package() .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:diag"); + + buildResult.Should().Pass(); + + // Correct asset should be copied to 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() { diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index c7f51e9b1675..039e09b4a50e 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -312,6 +312,30 @@ 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:diag") + .Should() + .Pass() + .And + .NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase); + } + [Fact] public void It_uses_lowercase_form_of_the_target_framework_for_the_output_path() { From db98a33c3443fdf7516f3685c64a2412f86a9c36 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 5 Sep 2017 21:56:48 -0700 Subject: [PATCH 26/34] Change log verbosity to normal when checking whether projects encounter conflicts --- .../GivenThatWeWantToBuildADesktopExe.cs | 6 +++--- .../GivenThatWeWantToBuildANetCoreApp.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs index 8b605a6ad01d..0b2359bfdc32 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,7 +455,7 @@ 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 @@ -494,7 +494,7 @@ public void It_does_not_report_conflicts_with_runtime_specific_items() var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); var buildResult = buildCommand - .Execute("/v:diag"); + .Execute("/v:normal"); buildResult.Should().Pass(); diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index 039e09b4a50e..1ca26d4e20d3 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -329,7 +329,7 @@ public void There_are_no_conflicts_when_targeting_netcoreapp_1_1() var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); buildCommand - .Execute("/v:diag") + .Execute("/v:normal") .Should() .Pass() .And From 7bdd496df3a7f5e43b4b9f58a5fec26f8d2fae31 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 7 Sep 2017 13:15:22 -0700 Subject: [PATCH 27/34] Add comment clarifying test expectation --- .../GivenThatWeWantToBuildADesktopExe.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs index 0b2359bfdc32..78a2df581226 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs @@ -498,7 +498,9 @@ public void It_does_not_report_conflicts_with_runtime_specific_items() buildResult.Should().Pass(); - // Correct asset should be copied to output folder + // 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"); From a5b05029b8b3d66820e5b861c8ced99f4f00aace Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 7 Sep 2017 13:50:00 -0700 Subject: [PATCH 28/34] Take locale portion of target path for satellite assemblies into account in conflict resolution Fixes #1465 --- src/Tasks/Common/src/ItemUtilities.cs | 12 +++++++++++- .../GivenThatWeWantToBuildADesktopExe.cs | 9 ++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Tasks/Common/src/ItemUtilities.cs b/src/Tasks/Common/src/ItemUtilities.cs index e776c6d3f8df..ba6f0a45f9e0 100644 --- a/src/Tasks/Common/src/ItemUtilities.cs +++ b/src/Tasks/Common/src/ItemUtilities.cs @@ -132,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/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs index 78a2df581226..9ad6d46048c7 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs @@ -479,9 +479,6 @@ public void It_does_not_report_conflicts_with_runtime_specific_items() .WithProjectChanges(p => { var ns = p.Root.Name.Namespace; - - - var itemGroup = new XElement(ns + "ItemGroup"); p.Root.Add(itemGroup); @@ -561,9 +558,11 @@ public void It_places_package_satellites_correctly(bool crossTarget) var buildCommand = new BuildCommand(Log, testAsset.TestRoot); 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"); outputDirectory.Should().NotHaveFile("FluentValidation.resources.dll"); From ebbf880e2bae5d488bf8b6b595949260657bc653 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 11 Sep 2017 12:09:04 -0700 Subject: [PATCH 29/34] Fix satellite assembly conflict resolution when targeting .NET Core --- .../DesktopUsingPackageWithSatellites.csproj | 12 ----- .../Program.cs | 15 ------ ...rosoft.PackageDependencyResolution.targets | 19 ++++++-- .../GivenThatWeWantToBuildADesktopExe.cs | 37 +++++++++------ .../GivenThatWeWantToBuildANetCoreApp.cs | 47 +++++++++++++++++++ .../TestPackageReference.cs | 5 ++ 6 files changed, 89 insertions(+), 46 deletions(-) delete mode 100644 TestAssets/TestProjects/DesktopUsingPackageWithSatellites/DesktopUsingPackageWithSatellites.csproj delete mode 100644 TestAssets/TestProjects/DesktopUsingPackageWithSatellites/Program.cs 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/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.PackageDependencyResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.PackageDependencyResolution.targets index 36b9b302206a..a8987149871c 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.PackageDependencyResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.PackageDependencyResolution.targets @@ -517,8 +517,20 @@ Copyright (c) .NET Foundation. All rights reserved. <_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 9ad6d46048c7..7909324e097c 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs @@ -538,25 +538,34 @@ 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("/v:normal") .Should() @@ -564,7 +573,7 @@ public void It_places_package_satellites_correctly(bool crossTarget) .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/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index 1ca26d4e20d3..1cc0b5a97d0a 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -336,6 +336,53 @@ public void There_are_no_conflicts_when_targeting_netcoreapp_1_1() .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(@"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.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; From 2955e559097eddbb0e5de2a5e4407a88df25e559 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 12 Sep 2017 18:41:15 -0700 Subject: [PATCH 30/34] Add build/test environment scripts --- build/sdk-build-env.bat | 18 ++++++++++++++++++ build/sdk-build-env.sh | 23 +++++++++++++++++++++++ build/sdk-test-env.bat | 22 ++++++++++++++++++++++ build/sdk-test-env.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 build/sdk-build-env.bat create mode 100644 build/sdk-build-env.sh create mode 100644 build/sdk-test-env.bat create mode 100644 build/sdk-test-env.sh diff --git a/build/sdk-build-env.bat b/build/sdk-build-env.bat new file mode 100644 index 000000000000..19d5a8b38c02 --- /dev/null +++ b/build/sdk-build-env.bat @@ -0,0 +1,18 @@ +@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. + +REM Get normalized version of parent path +for %%i in (%~dp0..\) DO ( + SET SDK_REPO_ROOT=%%~dpi +) + +title SDK Build (%SDK_REPO_ROOT%) +set PATH=%SDK_REPO_ROOT%.dotnet_cli;%PATH% +set /P SDK_CLI_VERSION=<%SDK_REPO_ROOT%DotnetCLIVersion.txt +rem set DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR=%SDK_REPO_ROOT%.dotnet_cli\sdk\%SDK_CLI_VERSION%\Sdks +set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +set DOTNET_MULTILEVEL_LOOKUP=0 + +set NUGET_PACKAGES=%SDK_REPO_ROOT%packages \ No newline at end of file diff --git a/build/sdk-build-env.sh b/build/sdk-build-env.sh new file mode 100644 index 000000000000..1a0c39a2abc0 --- /dev/null +++ b/build/sdk-build-env.sh @@ -0,0 +1,23 @@ +#!/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. +# + +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 + +REPO_ROOT="$( cd -P "$( dirname "$SOURCE" )/../" && pwd )" + +STAGE0_DIR=$REPO_ROOT/.dotnet_cli +export PATH=$STAGE0_DIR:$PATH + + +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_MULTILEVEL_LOOKUP=0 + +export NUGET_PACKAGES=$REPO_ROOT/packages diff --git a/build/sdk-test-env.bat b/build/sdk-test-env.bat new file mode 100644 index 000000000000..6add11c6ba7d --- /dev/null +++ b/build/sdk-test-env.bat @@ -0,0 +1,22 @@ +@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. + +REM Get normalized version of parent path +for %%i in (%~dp0..\) DO ( + SET SDK_REPO_ROOT=%%~dpi +) + +title SDK Test (%SDK_REPO_ROOT%) +set DOTNET_MULTILEVEL_LOOKUP=0 +set PATH=%SDK_REPO_ROOT%.dotnet_cli;%PATH% +set NUGET_PACKAGES=%SDK_REPO_ROOT%packages +set /P SDK_CLI_VERSION=<%SDK_REPO_ROOT%DotnetCLIVersion.txt +set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +set MSBuildSDKsPath=%SDK_REPO_ROOT%bin\Debug\Sdks +set DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR=%SDK_REPO_ROOT%bin\Debug\Sdks +set NETCoreSdkBundledVersionsProps=%SDK_REPO_ROOT%.dotnet_cli\sdk\%SDK_CLI_VERSION%\Microsoft.NETCoreSdk.BundledVersions.props +set CustomAfterMicrosoftCommonTargets=%SDK_REPO_ROOT%bin\Debug\Sdks\Microsoft.NET.Build.Extensions\msbuildExtensions-ver\Microsoft.Common.Targets\ImportAfter\Microsoft.NET.Build.Extensions.targets +set MicrosoftNETBuildExtensionsTargets=%SDK_REPO_ROOT%bin\Debug\Sdks\Microsoft.NET.Build.Extensions\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.targets +rem You also need to add https://dotnet.myget.org/F/dotnet-core/api/v3/index.json to your NuGet feeds if building projects outside the SDK cone \ No newline at end of file diff --git a/build/sdk-test-env.sh b/build/sdk-test-env.sh new file mode 100644 index 000000000000..9d67ff274833 --- /dev/null +++ b/build/sdk-test-env.sh @@ -0,0 +1,27 @@ +#!/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. +# + +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 + +REPO_ROOT="$( cd -P "$( dirname "$SOURCE" )/../" && pwd )" + +STAGE0_DIR=$REPO_ROOT/.dotnet_cli +SDK_CLI_VERSION="$( cat $REPO_ROOT/DotnetCLIVersion.txt )" + +export DOTNET_MULTILEVEL_LOOKUP=0 +export PATH=$STAGE0_DIR:$PATH +export NUGET_PACKAGES=$REPO_ROOT/packages +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export MSBuildSDKsPath=$REPO_ROOT/bin/Debug/Sdks +export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR=$REPO_ROOT/bin/Debug/Sdks +export NETCoreSdkBundledVersionsProps=$REPO_ROOT/.dotnet_cli/sdk/%SDK_CLI_VERSION%/Microsoft.NETCoreSdk.BundledVersions.props +export CustomAfterMicrosoftCommonTargets=$REPO_ROOT/bin/Debug/Sdks/Microsoft.NET.Build.Extensions/msbuildExtensions-ver/Microsoft.Common.Targets/ImportAfter/Microsoft.NET.Build.Extensions.targets +export MicrosoftNETBuildExtensionsTargets=$REPO_ROOT/bin/Debug/Sdks/Microsoft.NET.Build.Extensions/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.targets From 34da6b619907213d5e532b546445668e24e938b8 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 13 Sep 2017 14:30:26 -0700 Subject: [PATCH 31/34] Fix perf regression with setting DestinationSubPath on items for conflict resolution See https://github.com/Microsoft/msbuild/issues/2516 for details of the perf issue --- .../build/Microsoft.NET.ConflictResolution.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 83b5534f54bf..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 @@ -37,9 +37,9 @@ Copyright (c) .NET Foundation. All rights reserved. for conflicts). --> <_RuntimeTargetItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'RuntimeTarget'))" /> <__RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(_RuntimeTargetItems)" /> - <_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" - DestinationSubPath="%(FileDefinitions.Path)" - /> + <_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" /> + <_RuntimeTargetPublishItems Update="@(_RuntimeTargetPublishItems)" + DestinationSubPath="%(Path)" /> <_LockFileAssemblies Include="@(_RuntimeTargetPublishItems->WithMetadataValue('Type', 'assembly')->'%(ResolvedPath)')"> false From 65bb756167fca5bd9f8807153489eadd069ec981 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 13 Sep 2017 14:50:37 -0700 Subject: [PATCH 32/34] Fix test issue with path separator character --- .../GivenThatWeWantToBuildANetCoreApp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index 1cc0b5a97d0a..025043aa4ded 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -380,7 +380,7 @@ public void It_publishes_package_satellites_correctly(bool crossTarget) var outputDirectory = publishCommand.GetOutputDirectory(testProject.TargetFrameworks); outputDirectory.Should().NotHaveFile("Humanizer.resources.dll"); - outputDirectory.Should().HaveFile(@"fr\Humanizer.resources.dll"); + outputDirectory.Should().HaveFile(Path.Combine("fr", "Humanizer.resources.dll")); } [Fact] From f4661d428cd1003a08ec303ce9dba370ae283b55 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 20 Sep 2017 23:25:17 -0700 Subject: [PATCH 33/34] Update CLI version --- DotnetCLIVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index a39371d06e9a..8ab6e93ac144 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.0.2-vspre-006938 +2.0.2-vspre-006963 From f1fe4afbda25a10370747e94617ee7059480778c Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 25 Sep 2017 09:53:21 -0700 Subject: [PATCH 34/34] Pinning the SDK version to 2.0.2, because that has the right NuGet version in it. --- DotnetCLIVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 7e4122dbcc74..8ab6e93ac144 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.1.0-preview1-007041 +2.0.2-vspre-006963