From 50f6bb1b9e70a677f7db3e711f8aa424c98a8e8a Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 18 Aug 2021 12:03:35 -0700 Subject: [PATCH 1/5] Follow up to global usings changes * When reverting changes to the VisualBasic.targets file, a property initialization was missed. This would have introduced a regression for users upgrading to the 6.0 SDK when they had global imports disabled in their apps. * Only add implicitly enabled imports for C# projects. * Update the stage 0 SDK and re-enable skipped / altered tests Fixes https://github.com/dotnet/sdk/issues/19793 Fixes https://github.com/dotnet/sdk/issues/19696 --- global.json | 2 +- .../blazorhosted/blazorhosted-rid.csproj | 2 -- .../TestProjects/HelloWorld/HelloWorld.csproj | 1 - .../HelloWorldWithSubDirs.csproj | 1 - src/BlazorWasmSdk/Sdk/Sdk.props | 2 +- .../Installer/Windows/MsiPackageCache.cs | 4 +++ .../Installer/Windows/UpgradeAttributes.cs | 2 ++ .../install/NetSdkMsiInstallerClient.cs | 31 +++++++++++-------- src/Layout/toolset-tasks/toolset-tasks.csproj | 1 - .../Microsoft.NET.Sdk.VisualBasic.targets | 3 ++ .../EndToEnd.Tests/GivenDotNetUsesMSBuild.cs | 2 +- .../SampleGlobalTool/consoledemo.csproj | 1 + .../ConsoleDemoWithCasing.csproj | 1 + .../consoledemo.csproj | 1 + .../consoledemo.csproj | 1 + .../BlazorWasmBaselineTests.cs | 7 +++-- ...lazorWasmStaticWebAssetsIntegrationTest.cs | 4 +++ .../WasmJsModulesIntegrationTests.cs | 5 +-- .../AspNetSdkBaselineTest.cs | 5 ++- ...ComputeReferenceStaticWebAssetItemsTest.cs | 10 ++++-- ...uteStaticWebAssetsForCurrentProjectTest.cs | 9 ++++-- .../DiscoverStaticWebAssetsTest.cs | 9 ++++-- .../GenerateStaticWebAssetsManifestTest.cs | 8 +++-- .../MergeConfigurationPropertiesTest.cs | 3 ++ .../ReadStaticWebAssetsManifestFileTest.cs | 5 ++- src/Tests/dotnet-pack.Tests/PackTests.cs | 1 - .../GivenDotnetRunRunsCsProj.cs | 1 - src/WebSdk/Web/Sdk/Sdk.props | 2 +- .../Targets/Microsoft.NET.Sdk.Worker.props | 2 +- 29 files changed, 84 insertions(+), 42 deletions(-) diff --git a/global.json b/global.json index f692835fe2c7..11ec059291d0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "6.0.100-rc.1.21379.2", + "dotnet": "6.0.100-rc.1.21417.19", "runtimes": { "dotnet": [ "$(VSRedistCommonNetCoreSharedFrameworkx6460PackageVersion)" diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 8edcec2839cc..ec4b53947305 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -3,8 +3,6 @@ $(AspNetTestTfm) linux-x64 - - true diff --git a/src/Assets/TestProjects/HelloWorld/HelloWorld.csproj b/src/Assets/TestProjects/HelloWorld/HelloWorld.csproj index 3810a2a43c2c..ba7e2d463888 100644 --- a/src/Assets/TestProjects/HelloWorld/HelloWorld.csproj +++ b/src/Assets/TestProjects/HelloWorld/HelloWorld.csproj @@ -3,7 +3,6 @@ Exe $(CurrentTargetFramework) - true diff --git a/src/Assets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj b/src/Assets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj index c8bcf270826c..62be58344986 100644 --- a/src/Assets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj +++ b/src/Assets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj @@ -3,7 +3,6 @@ Exe $(CurrentTargetFramework) - true diff --git a/src/BlazorWasmSdk/Sdk/Sdk.props b/src/BlazorWasmSdk/Sdk/Sdk.props index 4b8eeabe2787..e15ec777d8d0 100644 --- a/src/BlazorWasmSdk/Sdk/Sdk.props +++ b/src/BlazorWasmSdk/Sdk/Sdk.props @@ -20,7 +20,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + diff --git a/src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs b/src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs index 9a1e5ce8a1be..0700cf863712 100644 --- a/src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs +++ b/src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs @@ -3,7 +3,11 @@ #nullable disable +using System; +using System.Collections.Generic; +using System.IO; using System.IO.Pipes; +using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Versioning; diff --git a/src/Cli/dotnet/Installer/Windows/UpgradeAttributes.cs b/src/Cli/dotnet/Installer/Windows/UpgradeAttributes.cs index 52c4e82ce8e7..8a4607e7f542 100644 --- a/src/Cli/dotnet/Installer/Windows/UpgradeAttributes.cs +++ b/src/Cli/dotnet/Installer/Windows/UpgradeAttributes.cs @@ -1,6 +1,8 @@ // 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 Microsoft.DotNet.Installer.Windows { /// diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs index 994bdbd4e020..119feb29846d 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs @@ -1,7 +1,12 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Runtime.Versioning; +using System.Threading; using System.Threading.Tasks; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.NuGetPackageDownloader; @@ -61,7 +66,7 @@ public NetSdkMsiInstallerClient(InstallElevationContextBase elevationContext, if (IsElevated) { - // Turn off automatic updates. We don't want MU to potentially patch the SDK + // Turn off automatic updates. We don't want MU to potentially patch the SDK // and it also reduces the risk of hitting ERROR_INSTALL_ALREADY_RUNNING. UpdateAgent.Stop(); } @@ -132,7 +137,7 @@ public void GarbageCollectInstalledWorkloadPacks(DirectoryPath? offlineCache = n { Log?.LogMessage($"Evaluating dependent for workload pack, dependent: {dependent}, pack ID: {packRecord.PackId}, pack version: {packRecord.PackVersion}"); - // Dependents created by the SDK should have 3 parts, for example, "Microsoft.NET.Sdk,6.0.100,x86". + // Dependents created by the SDK should have 3 parts, for example, "Microsoft.NET.Sdk,6.0.100,x86". string[] dependentParts = dependent.Split(','); if (dependentParts.Length != 3) @@ -254,18 +259,18 @@ public void InstallWorkloadManifest(ManifestId manifestId, ManifestVersion manif Log?.LogMessage($"Installing manifest: Id: {manifestId}, version: {manifestVersion}, feature band: {sdkFeatureBand}, rollback: {isRollback}."); // Resolve the package ID for the manifest payload package - string msiPackageId = WorkloadManifestUpdater.GetManifestPackageId(sdkFeatureBand, manifestId, InstallType.Msi).ToString(); + string msiPackageId = WorkloadManifestUpdater.GetManifestPackageId(sdkFeatureBand, manifestId, InstallType.Msi).ToString(); string msiPackageVersion = $"{manifestVersion}"; Log?.LogMessage($"Resolving {manifestId} ({manifestVersion}) to {msiPackageId} ({msiPackageVersion})."); - // Retrieve the payload from the MSI package cache. + // Retrieve the payload from the MSI package cache. MsiPayload msi = GetCachedMsiPayload(msiPackageId, msiPackageVersion, offlineCache); VerifyPackage(msi); DetectState state = DetectPackage(msi.ProductCode, out Version installedVersion); InstallAction plannedAction = PlanPackage(msi, state, InstallAction.Install, installedVersion, out IEnumerable relatedProducts); - // If we've detected a downgrade, it's possible we might be doing a rollback after the manifests were updated, + // If we've detected a downgrade, it's possible we might be doing a rollback after the manifests were updated, // but another error occurred. In this case we need to try and uninstall the upgrade and the install the lower // version of the MSI. if (plannedAction == InstallAction.Downgrade && isRollback && state == DetectState.Absent) @@ -277,7 +282,7 @@ public void InstallWorkloadManifest(ManifestId manifestId, ManifestVersion manif // Let's try and remove the SDK dependency. If anything's left then this is a shared installation, e.g. // the manifest was already installed by VS, we triggered a CLI installation, but because the package was - // present, we simply added a dependent against it. + // present, we simply added a dependent against it. UpdateDependent(InstallRequestType.RemoveDependent, msi.Manifest.ProviderKeyName, _dependent); if (depProvider.Dependents.Any()) @@ -342,7 +347,7 @@ public void RepairWorkloadPack(PackInfo packInfo, SdkFeatureBand sdkFeatureBand, // Determine the MSI payload package ID based on the host architecture, pack ID and pack version. string msiPackageId = GetMsiPackageId(packInfo); - // Retrieve the payload from the MSI package cache. + // Retrieve the payload from the MSI package cache. MsiPayload msi = GetCachedMsiPayload(msiPackageId, packInfo.Version, offlineCache); VerifyPackage(msi); DetectState state = DetectPackage(msi, out Version installedVersion); @@ -368,7 +373,7 @@ public void InstallWorkloadPack(PackInfo packInfo, SdkFeatureBand sdkFeatureBand // Determine the MSI payload package ID based on the host architecture, pack ID and pack version. string msiPackageId = GetMsiPackageId(packInfo); - // Retrieve the payload from the MSI package cache. + // Retrieve the payload from the MSI package cache. MsiPayload msi = GetCachedMsiPayload(msiPackageId, packInfo.Version, offlineCache); VerifyPackage(msi); DetectState state = DetectPackage(msi, out Version installedVersion); @@ -395,7 +400,7 @@ public void RollBackWorkloadPackInstall(PackInfo packInfo, SdkFeatureBand sdkFea // Determine the MSI payload package ID based on the host architecture, pack ID and pack version. string msiPackageId = GetMsiPackageId(packInfo); - // Retrieve the payload from the MSI package cache. + // Retrieve the payload from the MSI package cache. MsiPayload msi = GetCachedMsiPayload(msiPackageId, packInfo.Version, offlineCache); VerifyPackage(msi); @@ -606,7 +611,7 @@ private InstallAction PlanPackage(MsiPayload msi, DetectState state, InstallActi if (relatedProduct.Attributes.HasFlag(UpgradeAttributes.OnlyDetect) && (state == DetectState.Absent)) { - // If we're not installed, but detect-only related, it's very likely that + // If we're not installed, but detect-only related, it's very likely that // that we'd trigger a downgrade launch condition. We can't know for sure, but // generally that's the most common use for detect-only entries. plannedAction = InstallAction.Downgrade; @@ -665,7 +670,7 @@ private string ExtractPackage(string packageId, string packageVersion, Directory throw new FileNotFoundException(string.Format(LocalizableStrings.CacheMissingPackage, packageId, packageVersion, offlineCache)); } - // Extract the contents to a random folder to avoid potential file injection/hijacking + // Extract the contents to a random folder to avoid potential file injection/hijacking // shenanigans before moving it to the final cache directory. string extractionDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(extractionDirectory); @@ -699,7 +704,7 @@ private IEnumerable GetInstalledFeatureBands() /// /// Tries to retrieve the MSI payload for the specified package ID and version from - /// the MSI package cache. + /// the MSI package cache. /// /// The ID of the payload package. /// The version of the payload package. @@ -814,7 +819,7 @@ private void VerifyPackage(MsiPayload msiPayload) } /// - /// Creates a new instance. If the current host process is not elevated, + /// Creates a new instance. If the current host process is not elevated, /// the elevated server process will also be started by running an additional command. /// /// diff --git a/src/Layout/toolset-tasks/toolset-tasks.csproj b/src/Layout/toolset-tasks/toolset-tasks.csproj index beaf47979d90..30737580ed32 100644 --- a/src/Layout/toolset-tasks/toolset-tasks.csproj +++ b/src/Layout/toolset-tasks/toolset-tasks.csproj @@ -3,7 +3,6 @@ $(SdkTargetFramework);net472 $(SdkTargetFramework) true - true diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets index 79b21d6ecbde..7c0d920d30d5 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets @@ -10,6 +10,9 @@ Copyright (c) .NET Foundation. All rights reserved. *********************************************************************************************** --> + + $(DisableImplicitFrameworkReferences) + diff --git a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs index b93ea99eb431..fada1234601c 100644 --- a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs +++ b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs @@ -21,7 +21,7 @@ public GivenDotNetUsesMSBuild(ITestOutputHelper log) : base(log) { } - [RequiresMSBuildVersionFact("17.0.0.32901", Skip = "Unskipping tracked by https://github.com/dotnet/sdk/issues/19696")] + [RequiresMSBuildVersionFact("17.0.0.32901")] public void ItCanNewRestoreBuildRunCleanMSBuildProject() { string projectDirectory = _testAssetsManager.CreateTestDirectory().Path; diff --git a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalTool/consoledemo.csproj b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalTool/consoledemo.csproj index 0017ee4b6eee..2423b618afd8 100644 --- a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalTool/consoledemo.csproj +++ b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalTool/consoledemo.csproj @@ -10,5 +10,6 @@ false false false + false \ No newline at end of file diff --git a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithDifferentCasing/ConsoleDemoWithCasing.csproj b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithDifferentCasing/ConsoleDemoWithCasing.csproj index ffe2604a4b40..b8971531dd4f 100644 --- a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithDifferentCasing/ConsoleDemoWithCasing.csproj +++ b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithDifferentCasing/ConsoleDemoWithCasing.csproj @@ -10,5 +10,6 @@ false false false + false diff --git a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithPreview/consoledemo.csproj b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithPreview/consoledemo.csproj index 0017ee4b6eee..2423b618afd8 100644 --- a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithPreview/consoledemo.csproj +++ b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithPreview/consoledemo.csproj @@ -10,5 +10,6 @@ false false false + false \ No newline at end of file diff --git a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/consoledemo.csproj b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/consoledemo.csproj index 0017ee4b6eee..2423b618afd8 100644 --- a/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/consoledemo.csproj +++ b/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/consoledemo.csproj @@ -10,5 +10,6 @@ false false false + false \ No newline at end of file diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs index cf86b5be8808..510ff07911a6 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs @@ -1,7 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.NET.Sdk.Razor.Tests; using Microsoft.NET.TestFramework; @@ -22,7 +25,7 @@ private string TemplatizeCompressedAssets(StaticWebAsset asset, string originalV { return null; } - + if (asset.RelatedAsset == originalValue) { return null; diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs index 14c9e1e82282..f8d950f6ab36 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs @@ -2,6 +2,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Xml.Linq; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.NET.TestFramework.Assertions; diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs index 7bc9bc8fd6ea..905ea968d1b4 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // +using System; using System.IO; using System.Text.Json; using System.Xml.Linq; @@ -213,7 +214,7 @@ public void JsModules_CanCustomizeBlazorInitialization() - + '%(FullPath)')"" File=""$(IntermediateOutputPath)publish.extension.txt"" @@ -290,7 +291,7 @@ public void JsModules_Hosted_CanCustomizeBlazorInitialization() - + '%(FullPath)')"" File=""$(IntermediateOutputPath)publish.extension.txt"" diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/AspNetSdkBaselineTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/AspNetSdkBaselineTest.cs index 729b9bd94e3c..6b8f74c6f25b 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/AspNetSdkBaselineTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/AspNetSdkBaselineTest.cs @@ -1,7 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text.Json; diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs index d6d094e9da7a..2371ba739131 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs @@ -1,6 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.Build.Framework; @@ -101,8 +105,8 @@ public void PrefersSpecificKindAssetsOverAllKindAssets() { BuildEngine = buildEngine.Object, Source = "MyPackage", - Assets = new[] - { + Assets = new[] + { CreateCandidate("wwwroot\\candidate.js", "MyPackage", "Discovered", "candidate.js", "All", "All"), CreateCandidate("wwwroot\\candidate.other.js", "MyPackage", "Discovered", "candidate.js", "Build", "All") }, @@ -365,7 +369,7 @@ private ITaskItem CreateCandidate( result.ApplyDefaults(); result.Normalize(); - + return result.ToTaskItem(); } diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeStaticWebAssetsForCurrentProjectTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeStaticWebAssetsForCurrentProjectTest.cs index 4147ec94a80d..7815a1374b16 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeStaticWebAssetsForCurrentProjectTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeStaticWebAssetsForCurrentProjectTest.cs @@ -1,6 +1,9 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.IO; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.Build.Framework; @@ -48,8 +51,8 @@ public void PrefersSpecificKindAssetsOverAllKindAssets() { BuildEngine = buildEngine.Object, Source = "MyPackage", - Assets = new[] - { + Assets = new[] + { CreateCandidate("wwwroot\\candidate.js", "MyPackage", "Discovered", "candidate.js", "All", "All"), CreateCandidate("wwwroot\\candidate.other.js", "MyPackage", "Discovered", "candidate.js", "Build", "All") }, @@ -303,7 +306,7 @@ private ITaskItem CreateCandidate( result.ApplyDefaults(); result.Normalize(); - + return result.ToTaskItem(); } diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs index ecca9214d649..7fca2f701c67 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs @@ -1,7 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.Build.Framework; @@ -281,7 +284,7 @@ public void FailsDiscoveringAssetsWhenThereIsAConflict( // Assert result.Should().Be(false); errorMessages.Count.Should().Be(1); - errorMessages[0].Should().Be($@"Two assets found targeting the same path with incompatible asset kinds: + errorMessages[0].Should().Be($@"Two assets found targeting the same path with incompatible asset kinds: '{Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))}' with kind '{firstKind}' '{Path.GetFullPath(Path.Combine("wwwroot", "candidate.publish.js"))}' with kind '{secondKind}' for path 'candidate.js'"); @@ -393,10 +396,10 @@ private ITaskItem CreateCandidate( { ["RelativePath"] = relativePath ?? "", ["TargetPath"] = targetPath ?? "", - ["Link"] = link ?? "", + ["Link"] = link ?? "", ["CopyToOutputDirectory"] = copyToOutputDirectory ?? "", ["CopyToPublishDirectory"] = copyToPublishDirectory ?? "" - }); + }); } } } diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs index 6a45c273b08a..85af61b231e5 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs @@ -1,6 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.Build.Framework; @@ -76,7 +80,7 @@ public void GeneratesManifestWithAssets() var task = new GenerateStaticWebAssetsManifest { BuildEngine = buildEngine.Object, - Assets = new[] + Assets = new[] { asset.ToTaskItem() }, @@ -101,7 +105,7 @@ public void GeneratesManifestWithAssets() newAsset.Should().Be(asset); } - public static TheoryData> GeneratesManifestFailsWhenInvalidAssetsAreProvidedData + public static TheoryData> GeneratesManifestFailsWhenInvalidAssetsAreProvidedData { get { diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/MergeConfigurationPropertiesTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/MergeConfigurationPropertiesTest.cs index 4e632c6c4116..47712c5d1845 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/MergeConfigurationPropertiesTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/MergeConfigurationPropertiesTest.cs @@ -2,6 +2,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // +using System; +using System.Collections.Generic; +using System.IO; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; using Microsoft.Build.Framework; diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs index 7b81b070ca6c..21ee0fd05aa3 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs @@ -1,6 +1,9 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.IO; using System.Security.Principal; using System.Text.Json; using FluentAssertions; @@ -270,7 +273,7 @@ public void ConvertsDiscoveryPatternsToTaskItems() task.ReferencedProjectsConfiguration.Should().BeEmpty(); task.Assets.Should().BeEmpty(); var discoveryPattern = task.DiscoveryPatterns[0]; - + discoveryPattern.ItemSpec.ShouldBeEquivalentTo(Path.Combine("AnotherClassLib", "wwwroot")); discoveryPattern.GetMetadata(nameof(StaticWebAssetsManifest.DiscoveryPattern.Source)).ShouldBeEquivalentTo("AnotherClassLib"); discoveryPattern.GetMetadata(nameof(StaticWebAssetsManifest.DiscoveryPattern.ContentRoot)).ShouldBeEquivalentTo($"{contentRoot}"); diff --git a/src/Tests/dotnet-pack.Tests/PackTests.cs b/src/Tests/dotnet-pack.Tests/PackTests.cs index 839d2450e576..84e34c67a3d3 100644 --- a/src/Tests/dotnet-pack.Tests/PackTests.cs +++ b/src/Tests/dotnet-pack.Tests/PackTests.cs @@ -262,7 +262,6 @@ public void ItPacksAppWhenRestoringToSpecificPackageDirectory() new DotnetPackCommand(Log) .WithWorkingDirectory(rootPath) - .WithEnvironmentVariable("ImplicitUsings", "enable") // Removing tracked as part of https://github.com/dotnet/sdk/issues/19696 .Execute("--no-restore") .Should() .Pass(); diff --git a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs index 1c863ee49630..43b1e084dcc6 100644 --- a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs +++ b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs @@ -247,7 +247,6 @@ public void ItRunsAppWhenRestoringToSpecificPackageDirectory() new DotnetCommand(Log, "run") .WithWorkingDirectory(rootPath) - .WithEnvironmentVariable("ImplicitUsings", "enable") // Removing tracked as part of https://github.com/dotnet/sdk/issues/19696 .Execute("--no-restore") .Should().Pass() .And.HaveStdOutContaining("Hello, World"); diff --git a/src/WebSdk/Web/Sdk/Sdk.props b/src/WebSdk/Web/Sdk/Sdk.props index 3285d28e029b..e313e90ea356 100644 --- a/src/WebSdk/Web/Sdk/Sdk.props +++ b/src/WebSdk/Web/Sdk/Sdk.props @@ -58,7 +58,7 @@ Copyright (c) .NET Foundation. All rights reserved. IsImplicitlyDefined="true" /> - + diff --git a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props index cffa488585ca..d0631b5b8287 100644 --- a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props +++ b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props @@ -38,7 +38,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_ContentIncludedByDefault Include="@(Content)" /> - + From d4fd58612a6cdd2281708edf3da6a694e76f3de3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 19 Aug 2021 11:50:53 -0700 Subject: [PATCH 2/5] Update ScopedCssFileHandler.cs --- src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs b/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs index 0c8c21547eb5..0cc817b4b697 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs @@ -3,6 +3,8 @@ #nullable enable +using System; +using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Graph; using Microsoft.DotNet.Watcher.Internal; From 33dd4f1a997db81999b331c9543048affd2968cc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 19 Aug 2021 11:51:13 -0700 Subject: [PATCH 3/5] Update DotNetBuildFilter.cs --- src/BuiltInTools/dotnet-watch/Filters/DotNetBuildFilter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BuiltInTools/dotnet-watch/Filters/DotNetBuildFilter.cs b/src/BuiltInTools/dotnet-watch/Filters/DotNetBuildFilter.cs index a329bff375bf..d4d4a5999cc6 100644 --- a/src/BuiltInTools/dotnet-watch/Filters/DotNetBuildFilter.cs +++ b/src/BuiltInTools/dotnet-watch/Filters/DotNetBuildFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Threading; using System.Threading.Tasks; using Microsoft.DotNet.Watcher.Internal; using Microsoft.Extensions.Tools.Internal; From 2a8b3704c060b834dd1fbbd037a40eff23638037 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 19 Aug 2021 12:56:06 -0700 Subject: [PATCH 4/5] Fixup --- src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs b/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs index 0cc817b4b697..c28e90a08718 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/ScopedCssFileHandler.cs @@ -4,6 +4,8 @@ #nullable enable using System; +using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Graph; From aec9879129b8fadf15be6a1cc27b7e51f65d6fff Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 18 Aug 2021 18:13:00 -0700 Subject: [PATCH 5/5] Fix and disable tests for now --- src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs | 6 +++--- .../StaticWebAssets/DiscoverStaticWebAssetsTest.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs b/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs index 0414e9636291..25458e9eb160 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs @@ -116,7 +116,7 @@ public void It_should_fail_to_restore_without_workload_when_multitargeted() // .HaveStdOutContaining("android"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/sdk/issues/19866")] public void It_should_fail_to_build_without_workload_when_multitargeted() { var testProject = new TestProject() @@ -238,7 +238,7 @@ public void It_should_import_aliased_pack() .BeEquivalentTo("true"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/sdk/issues/19866")] public void It_should_get_suggested_workload_by_GetRequiredWorkloads_target() { var mainProject = new TestProject() @@ -266,7 +266,7 @@ public void It_should_get_suggested_workload_by_GetRequiredWorkloads_target() .BeEquivalentTo("microsoft-android-sdk-full"); } - [Theory] + [Theory(Skip = "https://github.com/dotnet/sdk/issues/19866")] [InlineData("net6.0-android;net6.0-ios", "net6.0-android;net6.0-ios", "microsoft-android-sdk-full;microsoft-ios-sdk-full")] [InlineData("net6.0", "net6.0;net6.0-android;net6.0-ios", "microsoft-android-sdk-full;microsoft-ios-sdk-full")] [InlineData("net6.0;net6.0-ios", "net6.0;net6.0-android", "microsoft-android-sdk-full;microsoft-ios-sdk-full")] diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs index 7fca2f701c67..423bb38fea17 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs @@ -284,7 +284,7 @@ public void FailsDiscoveringAssetsWhenThereIsAConflict( // Assert result.Should().Be(false); errorMessages.Count.Should().Be(1); - errorMessages[0].Should().Be($@"Two assets found targeting the same path with incompatible asset kinds: + errorMessages[0].Should().Be($@"Two assets found targeting the same path with incompatible asset kinds: '{Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))}' with kind '{firstKind}' '{Path.GetFullPath(Path.Combine("wwwroot", "candidate.publish.js"))}' with kind '{secondKind}' for path 'candidate.js'");