diff --git a/.editorconfig b/.editorconfig index 21e4302b9d1f..d0c5a7fc5ecf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -41,7 +41,7 @@ dotnet_style_qualification_for_event = false:suggestion # only use var when it's obvious what the variable type is csharp_style_var_for_built_in_types = false:none csharp_style_var_when_type_is_apparent = false:none -csharp_style_var_elsewhere = false:suggestion +csharp_style_var_elsewhere = false:none # use language keywords instead of BCL types dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion diff --git a/.gitattributes b/.gitattributes index 4422d1501f47..6bd3ace83f46 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,13 +1,13 @@ -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.doc binary +*.DOC binary +*.docx binary +*.DOCX binary +*.dot binary +*.DOT binary +*.pdf binary +*.PDF binary +*.rtf binary +*.RTF binary *.jpg binary *.png binary @@ -52,4 +52,4 @@ *.fsproj text=auto *.dbproj text=auto *.xlf text=auto -*.sln text=auto eol=crlf \ No newline at end of file +*.sln text=auto eol=crlf diff --git a/Directory.Build.props b/Directory.Build.props index c40c8555e1a2..f185d7241baf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,11 +1,6 @@ - - - - - $(CopyrightNetFoundation) - MIT - + + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) @@ -14,7 +9,24 @@ $(BuildArchitecture) $(BuildArchitecture) x64 + + + $(Architecture) + + + + + $(CopyrightNetFoundation) + MIT + + true -pgo diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 22d771abdb02..32a2283a9945 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28603.18 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34112.27 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}" EndProject @@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core-sdk-tasks", "src\core- EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.Utilities", "test\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj", "{78E15EC1-7732-41E3-8591-934E9F583254}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SdkResolver", "src\SdkResolver\SdkResolver.csproj", "{7EE15292-2CAD-44FA-8A1F-BAC4688A49E0}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Dotnet.Sdk.Internal", "src\Microsoft.Dotnet.Sdk.Internal\Microsoft.Dotnet.Sdk.Internal.csproj", "{73F07908-981B-41BB-B9BD-F3420274A6F7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SdkTests", "test\SdkTests\SdkTests.csproj", "{CB1EE94E-CB83-4071-9DD0-9929AE2B7282}" @@ -45,10 +43,6 @@ Global {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|Any CPU.Build.0 = Debug|Any CPU {78E15EC1-7732-41E3-8591-934E9F583254}.Release|Any CPU.ActiveCfg = Release|Any CPU {78E15EC1-7732-41E3-8591-934E9F583254}.Release|Any CPU.Build.0 = Release|Any CPU - {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0}.Release|Any CPU.Build.0 = Release|Any CPU {73F07908-981B-41BB-B9BD-F3420274A6F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73F07908-981B-41BB-B9BD-F3420274A6F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {73F07908-981B-41BB-B9BD-F3420274A6F7}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -70,7 +64,6 @@ Global {1BFF54F9-4E35-49DB-893C-AF2047722FC6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {53AF2D01-B69F-4CD0-86A7-8FD95967D23C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {78E15EC1-7732-41E3-8591-934E9F583254} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} - {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {CB1EE94E-CB83-4071-9DD0-9929AE2B7282} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {658EF9BE-452C-4D31-AA24-B9E2235799A8} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} EndGlobalSection diff --git a/Native.sln b/Native.sln deleted file mode 100644 index 29bd74903c46..000000000000 --- a/Native.sln +++ /dev/null @@ -1,48 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28603.18 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "finalizer_shim", "src\finalizer_shim\finalizer_shim.csproj", "{688E2883-C5A9-4D66-A207-772C9160989C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Debug|x64 = Debug|x64 - Debug|arm64 = Debug|arm64 - Debug|arm = Debug|arm - Release|x86 = Release|x86 - Release|x64 = Release|x64 - Release|arm64 = Release|arm64 - Release|arm = Release|arm - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x86.ActiveCfg = Debug|x86 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x86.Build.0 = Debug|x86 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x64.ActiveCfg = Debug|x64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x64.Build.0 = Debug|x64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.ActiveCfg = Debug|arm64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.Build.0 = Debug|arm64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.ActiveCfg = Debug|arm - {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.Build.0 = Debug|arm - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.ActiveCfg = Release|x86 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.Build.0 = Release|x86 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.ActiveCfg = Release|x64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.Build.0 = Release|x64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.ActiveCfg = Release|arm64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.Build.0 = Release|arm64 - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.ActiveCfg = Release|arm - {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.Build.0 = Release|arm - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {688E2883-C5A9-4D66-A207-772C9160989C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {18FCFCA3-D1A8-4D3A-9763-6A658D0D726F} - EndGlobalSection -EndGlobal diff --git a/eng/AfterSigning.targets b/eng/AfterSigning.targets index b8a08378a1b5..8e7aa3cf435c 100644 --- a/eng/AfterSigning.targets +++ b/eng/AfterSigning.targets @@ -1,12 +1,10 @@ - + + <_SuppressSdkImports>false - - + @@ -14,11 +12,12 @@ - + %(FullPath).sha512 + diff --git a/eng/Build.props b/eng/Build.props index 7e501b9fc62a..4f6005ef0971 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -12,9 +12,8 @@ - + diff --git a/eng/ManualVersions.props b/eng/ManualVersions.props index 57a4b6415199..ce3306b86cdd 100644 --- a/eng/ManualVersions.props +++ b/eng/ManualVersions.props @@ -1,12 +1,12 @@ - - + - 10.0.17763.31 @@ -16,4 +16,5 @@ 10.0.22000.31 10.0.22621.31 + diff --git a/eng/Publishing.props b/eng/Publishing.props index 28ae49196573..753393a0cee1 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -85,18 +85,15 @@ - - + + - - + diff --git a/eng/Signing.props b/eng/Signing.props index 852eea4b0bae..448c47e2e0da 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -5,6 +5,7 @@ custom publishing target. And should not be picked up by arcade's default publishing logic. --> + @@ -17,10 +18,7 @@ 3PartySHA2 MicrosoftDotNet500 - + true true @@ -33,6 +31,7 @@ + diff --git a/eng/Versions.props b/eng/Versions.props index f0cf9220a6c7..903f379641ef 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -71,9 +71,9 @@ 9.0.0-preview.4.24205.2 9.0.0-preview.4.24205.2 9.0.0-preview.4.24205.2 - 9.0.0-preview.4.24205.2 - 9.0.0-preview.4.24205.2 - 9.0.0-preview.4.24205.2 + 9.0.0-preview.4.24205.2 + 9.0.0-preview.4.24205.2 + 9.0.0-preview.4.24205.2 0.2.0 @@ -112,8 +112,7 @@ 9.0.0-preview.4.24204.1 - - + $(MicrosoftNETCoreAppHostwinx64PackageVersion) $(MicrosoftNETCoreAppRuntimewinx64PackageVersion) $(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion) diff --git a/eng/native.proj b/eng/native.proj deleted file mode 100644 index 736b175c3a90..000000000000 --- a/eng/native.proj +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(Architecture) - - - - - - - - - - - - diff --git a/eng/version.csproj b/eng/version.csproj deleted file mode 100644 index c745a34740ed..000000000000 --- a/eng/version.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - $(CoreSdkTargetFramework) - $(ArtifactsObjDir)sdk_version.h - - - - diff --git a/global.json b/global.json index 3ea10020ddb8..98ffce2502d9 100644 --- a/global.json +++ b/global.json @@ -12,6 +12,6 @@ }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24203.1", - "Microsoft.DotNet.CMake.Sdk": "9.0.0-beta.24203.1" - } + "Microsoft.DotNet.CMake.Sdk": "9.0.0-beta.24203.1", + "Microsoft.Build.NoTargets": "3.7.0" } } diff --git a/run-build.ps1 b/run-build.ps1 index b15dc53df30e..226dd8ade435 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -24,9 +24,6 @@ if ($PgoInstrument) { if ($Sign) { $Parameters = "$Parameters -sign /p:SignCoreSdk=true" - - # Workaround https://github.com/dotnet/arcade/issues/1776 - $WarnAsError = $false } $Parameters = "$Parameters -WarnAsError `$$WarnAsError" diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt index fa4fad712c8f..65d42d567a3d 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt @@ -82,12 +82,12 @@ src/fsharp/setup/resources/eula/*.rtf # False positive src/installer/src/core-sdk-tasks/BuildFPMToolPreReqs.cs|json -src/installer/src/redist/targets/packaging/osx/clisdk/resources/en.lproj/welcome.html|cecill-c +src/installer/src/redist/packaging/osx/resources/en.lproj/welcome.html|cecill-c src/installer/THIRD-PARTY-NOTICES|proprietary-license # Configuration, doesn't apply to source directly src/installer/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt -src/installer/src/redist/targets/packaging/**/*.json +src/installer/src/redist/packaging/**/*.json # # msbuild diff --git a/src/core-sdk-tasks/AddMetadataIsPE.cs b/src/core-sdk-tasks/AddMetadataIsPE.cs index aa003114dcb4..b0e894741073 100644 --- a/src/core-sdk-tasks/AddMetadataIsPE.cs +++ b/src/core-sdk-tasks/AddMetadataIsPE.cs @@ -26,16 +26,9 @@ public override bool Execute() { var resultItem = new TaskItem(item); item.CopyMetadataTo(resultItem); - - if (File.Exists(resultItem.GetMetadata("FullPath")) && - HasMetadata(resultItem.GetMetadata("FullPath"))) - { - resultItem.SetMetadata("IsPE", "True"); - } - else - { - resultItem.SetMetadata("IsPE", "False"); - } + + var isPe = File.Exists(resultItem.GetMetadata("FullPath")) && HasMetadata(resultItem.GetMetadata("FullPath")); + resultItem.SetMetadata("IsPE", isPe.ToString()); resultItemsList.Add(resultItem); } diff --git a/src/core-sdk-tasks/AzurePublisher.cs b/src/core-sdk-tasks/AzurePublisher.cs index 243fad789e17..bd25f079e7c9 100644 --- a/src/core-sdk-tasks/AzurePublisher.cs +++ b/src/core-sdk-tasks/AzurePublisher.cs @@ -27,7 +27,6 @@ public enum Product private const string s_dotnetBlobContainerName = "dotnet"; - private string _connectionString { get; set; } private string _containerName { get; set; } private CloudBlobContainer _blobContainer { get; set; } @@ -41,14 +40,7 @@ private CloudBlobContainer GetDotnetBlobContainer(string accountName, string acc { var storageCredentials = new StorageCredentials(accountName, accountKey); var storageAccount = new CloudStorageAccount(storageCredentials, true); - return GetDotnetBlobContainer(storageAccount, containerName); - } - - private CloudBlobContainer GetDotnetBlobContainer(CloudStorageAccount storageAccount, string containerName) - { - CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); - - return blobClient.GetContainerReference(containerName); + return storageAccount.CreateCloudBlobClient().GetContainerReference(containerName); } public string UploadFile(string file, Product product, string version) @@ -105,11 +97,7 @@ private void SetBlobPropertiesBasedOnFileType(CloudBlockBlob blockBlob) } } - public IEnumerable ListBlobs(Product product, string version) - { - string virtualDirectory = $"{product}/{version}"; - return ListBlobs(virtualDirectory); - } + public IEnumerable ListBlobs(Product product, string version) => ListBlobs($"{product}/{version}"); public IEnumerable ListBlobs(string virtualDirectory) { @@ -120,10 +108,7 @@ public IEnumerable ListBlobs(string virtualDirectory) return blobFiles.Results.Select(bf => bf.Uri.PathAndQuery.Replace($"/{_containerName}/", string.Empty)); } - public string AcquireLeaseOnBlob( - string blob, - TimeSpan? maxWaitDefault = null, - TimeSpan? delayDefault = null) + public string AcquireLeaseOnBlob(string blob, TimeSpan? maxWaitDefault = null, TimeSpan? delayDefault = null) { TimeSpan maxWait = maxWaitDefault ?? TimeSpan.FromSeconds(120); TimeSpan delay = delayDefault ?? TimeSpan.FromMilliseconds(500); @@ -194,26 +179,18 @@ public bool TryDeleteBlob(string path) try { DeleteBlob(path); - return true; } catch (Exception e) { Console.WriteLine($"Deleting blob {path} failed with \r\n{e.Message}"); - return false; } } - private void DeleteBlob(string path) - { - _blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait(); - } + private void DeleteBlob(string path) => _blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait(); - private static string CalculateRelativePathForFile(string file, Product product, string version) - { - return $"{product}/{version}/{Path.GetFileName(file)}"; - } + private static string CalculateRelativePathForFile(string file, Product product, string version) => $"{product}/{version}/{Path.GetFileName(file)}"; } } #endif diff --git a/src/core-sdk-tasks/BuildFPMToolPreReqs.cs b/src/core-sdk-tasks/BuildFPMToolPreReqs.cs index b24fbfd10a48..b19bf217d845 100644 --- a/src/core-sdk-tasks/BuildFPMToolPreReqs.cs +++ b/src/core-sdk-tasks/BuildFPMToolPreReqs.cs @@ -6,7 +6,6 @@ using Microsoft.Build.Utilities; using Microsoft.Build.Framework; using System.IO; -using System.Linq; using System.Text; using Newtonsoft.Json; @@ -116,32 +115,29 @@ private string BuildCmdParameters(ConfigJson configJson, string package_version) // --verbose : Set verbose output for FPM tool --Static // : Add all the folder mappings for package_root, docs, man pages --Static - var parameters = new List(); - parameters.Add("-s dir"); - parameters.Add("-t rpm"); - parameters.Add(string.Concat("-n ", configJson.Package_Name)); - parameters.Add(string.Concat("-v ", package_version)); - parameters.Add(string.Concat("-a ", configJson.Control.Architecture)); + var parameters = new List + { + "-s dir", + "-t rpm", + string.Concat("-n ", configJson.Package_Name), + string.Concat("-v ", package_version), + string.Concat("-a ", configJson.Control.Architecture) + }; // Build the list of dependencies as -d -d if (configJson.Rpm_Dependencies != null) { foreach (RpmDependency rpmdep in configJson.Rpm_Dependencies) { - string dependency = ""; if (rpmdep.Package_Name != "") { // If no version is specified then the dependency is just the package without >= check - if (rpmdep.Package_Version == "") - { - dependency = rpmdep.Package_Name; - } - else - { - dependency = string.Concat(rpmdep.Package_Name, " >= ", rpmdep.Package_Version); - } + string dependency = rpmdep.Package_Version != "" ? + string.Concat(rpmdep.Package_Name, " >= ", rpmdep.Package_Version) : + rpmdep.Package_Name; + + parameters.Add(string.Concat("-d ", EscapeArg(dependency))); } - if (dependency != "") parameters.Add(string.Concat("-d ", EscapeArg(dependency))); } } @@ -183,14 +179,11 @@ private string BuildCmdParameters(ConfigJson configJson, string package_version) // Map all the payload directories as they need to install on the system if (configJson.Install_Root != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "package_root/="), - configJson.Install_Root)); // Package Files + parameters.Add(string.Concat(Path.Combine(InputDir, "package_root/="), configJson.Install_Root)); // Package Files if (configJson.Install_Man != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "docs", "host/="), - configJson.Install_Man)); // Man Pages + parameters.Add(string.Concat(Path.Combine(InputDir, "docs", "host/="), configJson.Install_Man)); // Man Pages if (configJson.Install_Doc != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "templates", "copyright="), - configJson.Install_Doc)); // CopyRight File + parameters.Add(string.Concat(Path.Combine(InputDir, "templates", "copyright="), configJson.Install_Doc)); // CopyRight File return string.Join(" ", parameters); } @@ -220,14 +213,12 @@ private string EscapeArg(string arg) { sb.Append('\\', 2 * backslashCount); } - // Escape any preceding backslashes and the quote else if (arg[i] == '"') { sb.Append('\\', (2 * backslashCount) + 1); sb.Append('"'); } - // Output any consumed backslashes and the character else { @@ -255,6 +246,7 @@ private bool ShouldSurroundWithQuotes(string argument) { return true; } + return false; } } diff --git a/src/core-sdk-tasks/CalculateTemplateVersions.cs b/src/core-sdk-tasks/CalculateTemplateVersions.cs index 0d12e7ea47cc..0774a3858612 100644 --- a/src/core-sdk-tasks/CalculateTemplateVersions.cs +++ b/src/core-sdk-tasks/CalculateTemplateVersions.cs @@ -28,7 +28,6 @@ public class CalculateTemplateVersions : Task [Required] public int CombinedBuildNumberAndRevision { get; set; } - // Should be the BundledTemplates with BundledTemplateInstallPath metadata set to the value calculated for that group [Output] public ITaskItem [] BundledTemplatesWithInstallPaths { get; set; } @@ -39,11 +38,10 @@ public class CalculateTemplateVersions : Task // TemplatesMajorMinorVersion: 6.0 (from BundledTemplateMajorMinorVersion from group) // InstallerUpgradeCode: Guid generated using GenerateGuidFromName, combining TemplateBaseFilename, FullNugetVersion, ProductMonikerRid, and InstallerExtension // MSIVersion: Result of calling GenerateMsiVersionFromFullVersion logic with CombinedBuildNumberAndRevision and BundledTemplateMajorMinorPatchVersion from template group - [Output] public ITaskItem [] TemplatesComponents { get; set; } - private const int _patchVersionResetOffset = 1; + private const int PatchVersionResetOffset = 1; public override bool Execute() { @@ -62,20 +60,20 @@ public override bool Execute() BundledTemplatesWithInstallPaths = BundledTemplates.Select(t => { var templateWithInstallPath = new TaskItem(t); - templateWithInstallPath.SetMetadata("BundledTemplateInstallPath", groups[t.GetMetadata("TemplateFrameworkVersion")].BundledTemplateInstallPath); + templateWithInstallPath.SetMetadata("BundledTemplateInstallPath", groups[t.GetMetadata("TemplateFrameworkVersion")].InstallPath); return templateWithInstallPath; }).ToArray(); TemplatesComponents = groups.Select(g => { - string majorMinorWithoutDots = g.Value.BundledTemplateMajorMinorVersion.Replace(".", ""); + string majorMinorWithoutDots = g.Value.MajorMinorVersion.Replace(".", ""); var componentItem = new TaskItem($"NetCore{majorMinorWithoutDots}Templates"); var templateBaseFilename = $"dotnet-{majorMinorWithoutDots}templates"; componentItem.SetMetadata("TemplateBaseFilename", templateBaseFilename); - componentItem.SetMetadata("TemplatesMajorMinorVersion", g.Value.BundledTemplateMajorMinorVersion); + componentItem.SetMetadata("TemplatesMajorMinorVersion", g.Value.MajorMinorVersion); var installerUpgradeCode = GenerateGuidFromName.GenerateGuid(string.Join("-", templateBaseFilename, FullNugetVersion, ProductMonikerRid) + InstallerExtension).ToString().ToUpper(); componentItem.SetMetadata("InstallerUpgradeCode", installerUpgradeCode); - componentItem.SetMetadata("MSIVersion", GenerateMsiVersionFromFullVersion.GenerateMsiVersion(CombinedBuildNumberAndRevision, g.Value.BundledTemplateMajorMinorPatchVersion)); + componentItem.SetMetadata("MSIVersion", GenerateMsiVersionFromFullVersion.GenerateMsiVersion(CombinedBuildNumberAndRevision, g.Value.MajorMinorPatchVersion)); var brandName = System.Version.Parse(g.Key).Major >= 5 ? $"Microsoft .NET {g.Key} Templates" : @@ -89,24 +87,20 @@ public override bool Execute() return true; } - public static - (string BundledTemplateInstallPath, - string BundledTemplateMajorMinorVersion, - string BundledTemplateMajorMinorPatchVersion) - Calculate(string aspNetCorePackageVersionTemplate) + public static BundledTemplate Calculate(string aspNetCorePackageVersionTemplate) { var aspNetCoreTemplate = NuGetVersion.Parse(aspNetCorePackageVersionTemplate); - NuGetVersion baseMajorMinorPatch = GetBaseMajorMinorPatch(aspNetCoreTemplate); - string bundledTemplateInstallPath = aspNetCoreTemplate.IsPrerelease ? $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}-{aspNetCoreTemplate.Release}" : $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}"; - return ( - bundledTemplateInstallPath, - $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}", - $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}"); + return new BundledTemplate + { + InstallPath = bundledTemplateInstallPath, + MajorMinorVersion = $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}", + MajorMinorPatchVersion = $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}" + }; } private static NuGetVersion GetBaseMajorMinorPatch(NuGetVersion aspNetCoreTemplate) @@ -116,15 +110,17 @@ private static NuGetVersion GetBaseMajorMinorPatch(NuGetVersion aspNetCoreTempla // more in the above bug's detail. // There is no non-deterministic existing ComponentId under Major version 5. // so only apply the patch bump when below 5 - - int basePatch = - aspNetCoreTemplate.Major < 5 - ? aspNetCoreTemplate.Patch + _patchVersionResetOffset - : aspNetCoreTemplate.Patch; - - var baseMajorMinorPatch = new NuGetVersion(aspNetCoreTemplate.Major, aspNetCoreTemplate.Minor, - basePatch); - return baseMajorMinorPatch; + int basePatch = aspNetCoreTemplate.Major < 5 ? + aspNetCoreTemplate.Patch + PatchVersionResetOffset : + aspNetCoreTemplate.Patch; + return new NuGetVersion(aspNetCoreTemplate.Major, aspNetCoreTemplate.Minor, basePatch); } } + + public class BundledTemplate + { + public string InstallPath { get; set; } + public string MajorMinorVersion { get; set; } + public string MajorMinorPatchVersion { get; set; } + } } diff --git a/src/core-sdk-tasks/Chmod.cs b/src/core-sdk-tasks/Chmod.cs index 1d87e93c7b3d..f4133c03d729 100644 --- a/src/core-sdk-tasks/Chmod.cs +++ b/src/core-sdk-tasks/Chmod.cs @@ -16,44 +16,18 @@ public class Chmod : ToolTask public bool Recursive { get; set; } - protected override string ToolName - { - get { return "chmod"; } - } - - protected override MessageImportance StandardOutputLoggingImportance - { - get { return MessageImportance.High; } // or else the output doesn't get logged by default - } - - protected override string GenerateFullPathToTool() - { - return "chmod"; - } - - protected override string GenerateCommandLineCommands() - { - return $"{GetRecursive()} {GetMode()} {GetGlob()}"; - } - - private string GetGlob() - { - return Glob; - } - - private string GetMode() - { - return Mode; - } - - private string GetRecursive() - { - if(Recursive) - { - return "--recursive"; - } - - return null; - } + protected override string ToolName => "chmod"; + + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High; + + protected override string GenerateFullPathToTool() => "chmod"; + + protected override string GenerateCommandLineCommands() => $"{GetRecursive()} {GetMode()} {GetGlob()}"; + + private string GetGlob() => Glob; + + private string GetMode() => Mode; + + private string GetRecursive() => Recursive ? "--recursive" : null; } } diff --git a/src/core-sdk-tasks/CollatePackageDownloads.cs b/src/core-sdk-tasks/CollatePackageDownloads.cs index 9e31720fe61c..e37de44068bd 100644 --- a/src/core-sdk-tasks/CollatePackageDownloads.cs +++ b/src/core-sdk-tasks/CollatePackageDownloads.cs @@ -1,10 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; diff --git a/src/core-sdk-tasks/Constants.cs b/src/core-sdk-tasks/Constants.cs deleted file mode 100644 index 263c35c00bdf..000000000000 --- a/src/core-sdk-tasks/Constants.cs +++ /dev/null @@ -1,13 +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.Runtime.InteropServices; - -namespace Microsoft.DotNet.Cli.Build.Framework -{ - public static class Constants - { - //public static readonly string ProjectFileName = "project.json"; - public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; - } -} diff --git a/src/core-sdk-tasks/Crossgen.cs b/src/core-sdk-tasks/Crossgen.cs index a45e3d96f49f..4c11dc74fb50 100644 --- a/src/core-sdk-tasks/Crossgen.cs +++ b/src/core-sdk-tasks/Crossgen.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using Microsoft.Build.Framework; @@ -63,12 +61,12 @@ public override bool Execute() if (toolResult) { - var files = System.IO.Directory.GetFiles(Path.GetDirectoryName(TempOutputPath)); - var dest = Path.GetDirectoryName(DestinationPath); + var files = Directory.GetFiles(Path.GetDirectoryName(TempOutputPath)); + var destination = Path.GetDirectoryName(DestinationPath); // Copy both dll and pdb files to the destination folder foreach(var file in files) { - File.Copy(file, Path.Combine(dest, Path.GetFileName(file)), overwrite: true); + File.Copy(file, Path.Combine(destination, Path.GetFileName(file)), overwrite: true); // Delete file in temp File.Delete(file); } @@ -83,22 +81,13 @@ public override bool Execute() return toolResult; } - protected override string ToolName - { - get { return "crossgen2"; } - } + protected override string ToolName => "crossgen2"; - protected override MessageImportance StandardOutputLoggingImportance - { - // Default is low, but we want to see output at normal verbosity. - get { return MessageImportance.Normal; } - } + // Default is low, but we want to see output at normal verbosity. + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.Normal; - protected override MessageImportance StandardErrorLoggingImportance - { - // This turns stderr messages into msbuild errors below. - get { return MessageImportance.High; } - } + // This turns stderr messages into msbuild errors below. + protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High; protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) { @@ -124,56 +113,21 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport } } - protected override string GenerateFullPathToTool() - { - if (CrossgenPath != null) - { - return CrossgenPath; - } + protected override string GenerateFullPathToTool() => CrossgenPath ?? "crossgen2"; - return "crossgen2"; - } + protected override string GenerateCommandLineCommands() => $"{GetInPath()} {GetOutPath()} {GetArchitecture()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}"; - protected override string GenerateCommandLineCommands() - { - return $"{GetInPath()} {GetOutPath()} {GetArchitecture()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}"; - } + private string GetArchitecture() => $"--targetarch {Architecture}"; - private string GetArchitecture() - { - return $"--targetarch {Architecture}"; - } + private string GetCreateSymbols() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "--pdb" : "--perfmap"; - private string GetCreateSymbols() - { - var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "--pdb" : "--perfmap"; - return $"{option}"; - } + private string GetInPath() => $"\"{SourceAssembly}\""; - private string GetReadyToRun() - { - if (ReadyToRun) - { - return "-readytorun"; - } - - return null; - } - - private string GetInPath() - { - return $"\"{SourceAssembly}\""; - } - - private string GetOutPath() - { - return $"-o \"{TempOutputPath}\""; - } + private string GetOutPath() => $"-o \"{TempOutputPath}\""; private string GetPlatformAssemblyPaths() { - var platformAssemblyPaths = String.Empty; - + var platformAssemblyPaths = string.Empty; if (PlatformAssemblyPaths != null) { foreach (var excludeTaskItem in PlatformAssemblyPaths) @@ -184,15 +138,7 @@ private string GetPlatformAssemblyPaths() return platformAssemblyPaths; } - - private string GetMissingDependenciesOk() - { - return "-MissingDependenciesOK"; - } - protected override void LogToolCommand(string message) - { - base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}"); - } + protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); } } diff --git a/src/core-sdk-tasks/DotNetDebTool.cs b/src/core-sdk-tasks/DotNetDebTool.cs index 4c9d3e8bc626..d7f4fd712793 100644 --- a/src/core-sdk-tasks/DotNetDebTool.cs +++ b/src/core-sdk-tasks/DotNetDebTool.cs @@ -25,50 +25,30 @@ public class DotNetDebTool : ToolTask protected override string ToolName => "package_tool.sh"; - private string GetInputDir() - { - return $"-i {InputDirectory}"; - } + private string GetInputDir() => $"-i {InputDirectory}"; - private string GetOutputFile() - { - return $"-o {OutputDirectory}"; - } + private string GetOutputFile() => $"-o {OutputDirectory}"; - private string GetPackageName() - { - return $"-n {PackageName}"; - } + private string GetPackageName() => $"-n {PackageName}"; - private string GetPackageVersion() - { - return $"-v {PackageVersion}"; - } + private string GetPackageVersion() => $"-v {PackageVersion}"; - protected override MessageImportance StandardOutputLoggingImportance - { - get { return MessageImportance.High; } // or else the output doesn't get logged by default - } + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High; protected override string GenerateFullPathToTool() { - string path = ToolPath; - // if ToolPath was not provided by the MSBuild script - if (string.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(ToolPath)) { Log.LogError($"Could not find the Path to {ToolName}"); return string.Empty; } - return path; + return ToolPath; } - protected override string GetWorkingDirectory() - { - return WorkingDirectory ?? base.GetWorkingDirectory(); - } + protected override string GetWorkingDirectory() => WorkingDirectory ?? base.GetWorkingDirectory(); protected override string GenerateCommandLineCommands() { @@ -79,26 +59,13 @@ protected override string GenerateCommandLineCommands() return commandLineCommands; } - protected override void LogToolCommand(string message) - { - base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); - } + protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); - protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) - { - Log.LogMessage(messageImportance, singleLine, null); - } + protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) => Log.LogMessage(messageImportance, singleLine, null); - protected override ProcessStartInfo GetProcessStartInfo( - string pathToTool, - string commandLineCommands, - string responseFileSwitch) + protected override ProcessStartInfo GetProcessStartInfo(string pathToTool, string commandLineCommands, string responseFileSwitch) { - var psi = base.GetProcessStartInfo( - pathToTool, - commandLineCommands, - responseFileSwitch); - + var psi = base.GetProcessStartInfo(pathToTool, commandLineCommands, responseFileSwitch); foreach (var environmentVariableName in new EnvironmentFilter().GetEnvironmentVariableNamesToRemove()) { psi.Environment.Remove(environmentVariableName); diff --git a/src/core-sdk-tasks/DotNetTool.cs b/src/core-sdk-tasks/DotNetTool.cs index 3f164eb0a468..2a7c834b4b3e 100644 --- a/src/core-sdk-tasks/DotNetTool.cs +++ b/src/core-sdk-tasks/DotNetTool.cs @@ -1,10 +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.Diagnostics; - +using System.Runtime.InteropServices; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; - using Microsoft.DotNet.Cli.Build.Framework; namespace Microsoft.DotNet.Cli.Build @@ -19,16 +18,9 @@ public DotNetTool() protected abstract string Args { get; } - protected override ProcessStartInfo GetProcessStartInfo( - string pathToTool, - string commandLineCommands, - string responseFileSwitch) + protected override ProcessStartInfo GetProcessStartInfo(string pathToTool, string commandLineCommands, string responseFileSwitch) { - var psi = base.GetProcessStartInfo( - pathToTool, - commandLineCommands, - responseFileSwitch); - + var psi = base.GetProcessStartInfo(pathToTool, commandLineCommands, responseFileSwitch); foreach (var environmentVariableName in new EnvironmentFilter().GetEnvironmentVariableNamesToRemove()) { psi.Environment.Remove(environmentVariableName); @@ -39,35 +31,24 @@ protected override ProcessStartInfo GetProcessStartInfo( public string WorkingDirectory { get; set; } - protected override string ToolName - { - get { return $"dotnet{Constants.ExeSuffix}"; } - } + protected override string ToolName => $"dotnet{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty)}"; - protected override MessageImportance StandardOutputLoggingImportance - { - get { return MessageImportance.High; } // or else the output doesn't get logged by default - } + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High; protected override string GenerateFullPathToTool() { - string path = ToolPath; - - // if ToolPath was not provided by the MSBuild script - if (string.IsNullOrEmpty(path)) + // if ToolPath was not provided by the MSBuild script + if (string.IsNullOrEmpty(ToolPath)) { Log.LogError($"Could not find the Path to {ToolName}"); return string.Empty; } - return path; + return ToolPath; } - protected override string GetWorkingDirectory() - { - return WorkingDirectory ?? base.GetWorkingDirectory(); - } + protected override string GetWorkingDirectory() => WorkingDirectory ?? base.GetWorkingDirectory(); protected override string GenerateCommandLineCommands() { @@ -78,9 +59,6 @@ protected override string GenerateCommandLineCommands() return commandLineCommands; } - protected override void LogToolCommand(string message) - { - base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); - } + protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); } } diff --git a/src/core-sdk-tasks/EnvironmentVariableFilter.cs b/src/core-sdk-tasks/EnvironmentVariableFilter.cs index 069c2cd37bb3..6b82fa32ce93 100644 --- a/src/core-sdk-tasks/EnvironmentVariableFilter.cs +++ b/src/core-sdk-tasks/EnvironmentVariableFilter.cs @@ -9,15 +9,15 @@ namespace Microsoft.DotNet.Cli.Build { public class EnvironmentFilter { - private const string _MSBuildEnvironmentVariablePrefix = "MSBuild"; - private const string _DotNetEnvironmentVariablePrefix = "DOTNET"; - private const string _NugetEnvironmentVariablePrefix = "NUGET"; + private const string MSBuildEnvironmentVariablePrefix = "MSBuild"; + private const string DotNetEnvironmentVariablePrefix = "DOTNET"; + private const string NugetEnvironmentVariablePrefix = "NUGET"; private IEnumerable _prefixesOfEnvironmentVariablesToRemove = new string [] { - _MSBuildEnvironmentVariablePrefix, - _DotNetEnvironmentVariablePrefix, - _NugetEnvironmentVariablePrefix + MSBuildEnvironmentVariablePrefix, + DotNetEnvironmentVariablePrefix, + NugetEnvironmentVariablePrefix }; private IEnumerable _environmentVariablesToRemove = new string [] @@ -36,7 +36,7 @@ public class EnvironmentFilter public IEnumerable GetEnvironmentVariableNamesToRemove() { - var allEnvironmentVariableNames = (IEnumerable)Environment + var allEnvironmentVariableNames = Environment .GetEnvironmentVariables() .Keys .Cast(); diff --git a/src/core-sdk-tasks/ExtractArchiveToDirectory.cs b/src/core-sdk-tasks/ExtractArchiveToDirectory.cs index 4416122479e3..d7836d7e1b75 100644 --- a/src/core-sdk-tasks/ExtractArchiveToDirectory.cs +++ b/src/core-sdk-tasks/ExtractArchiveToDirectory.cs @@ -47,13 +47,10 @@ protected override bool ValidateParameters() var retVal = true; - if (Directory.Exists(DestinationDirectory)) + if (Directory.Exists(DestinationDirectory) && CleanDestination == true) { - if (CleanDestination == true) - { - Log.LogMessage(MessageImportance.Low, "'{0}' already exists, trying to delete before unzipping...", DestinationDirectory); - Directory.Delete(DestinationDirectory, recursive: true); - } + Log.LogMessage(MessageImportance.Low, "'{0}' already exists, trying to delete before unzipping...", DestinationDirectory); + Directory.Delete(DestinationDirectory, recursive: true); } if (!File.Exists(SourceArchive)) @@ -178,35 +175,14 @@ public override bool Execute() return retVal; } - private bool ShouldExtractItem(string path) - { - if (DirectoriesToCopy != null) - { - return DirectoriesToCopy.Any(p => path.StartsWith(p.ItemSpec)); - - } - - return false; - } + private bool ShouldExtractItem(string path) => DirectoriesToCopy?.Any(p => path.StartsWith(p.ItemSpec)) ?? false; - protected override string ToolName - { - get { return "tar"; } - } + protected override string ToolName => "tar"; - protected override MessageImportance StandardOutputLoggingImportance - { - get { return MessageImportance.High; } // or else the output doesn't get logged by default - } + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High; - protected override string GenerateFullPathToTool() - { - return "tar"; - } + protected override string GenerateFullPathToTool() => "tar"; - protected override string GenerateCommandLineCommands() - { - return $"xf {SourceArchive} -C {DestinationDirectory}"; - } + protected override string GenerateCommandLineCommands() => $"xf {SourceArchive} -C {DestinationDirectory}"; } } diff --git a/src/core-sdk-tasks/GenerateDefaultRuntimeFrameworkVersion.cs b/src/core-sdk-tasks/GenerateDefaultRuntimeFrameworkVersion.cs index 8545731d5cdd..6c9cccd23e15 100644 --- a/src/core-sdk-tasks/GenerateDefaultRuntimeFrameworkVersion.cs +++ b/src/core-sdk-tasks/GenerateDefaultRuntimeFrameworkVersion.cs @@ -19,21 +19,14 @@ public override bool Execute() { if (NuGetVersion.TryParse(RuntimePackVersion, out var version)) { - if (version.IsPrerelease && version.Patch == 0) - { - DefaultRuntimeFrameworkVersion = RuntimePackVersion; - } - else - { - DefaultRuntimeFrameworkVersion = new NuGetVersion(version.Major, version.Minor, 0).ToFullString(); - } + DefaultRuntimeFrameworkVersion = version.IsPrerelease && version.Patch == 0 ? + RuntimePackVersion : + new NuGetVersion(version.Major, version.Minor, 0).ToFullString(); return true; } - else - { - return false; - } + + return false; } } } diff --git a/src/core-sdk-tasks/GenerateGuidFromName.cs b/src/core-sdk-tasks/GenerateGuidFromName.cs index 709e4ec64f74..0b9e46120fc5 100644 --- a/src/core-sdk-tasks/GenerateGuidFromName.cs +++ b/src/core-sdk-tasks/GenerateGuidFromName.cs @@ -3,8 +3,6 @@ using System; using System.Security.Cryptography; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; namespace Microsoft.DotNet.Cli.Build { diff --git a/src/core-sdk-tasks/GenerateSdkRuntimeIdentifierChain.cs b/src/core-sdk-tasks/GenerateSdkRuntimeIdentifierChain.cs index 1e5c9d33e929..4b805e1da411 100644 --- a/src/core-sdk-tasks/GenerateSdkRuntimeIdentifierChain.cs +++ b/src/core-sdk-tasks/GenerateSdkRuntimeIdentifierChain.cs @@ -1,11 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using NuGet.RuntimeModel; diff --git a/src/core-sdk-tasks/GetDependencyInfo.cs b/src/core-sdk-tasks/GetDependencyInfo.cs index 9091401139fa..60b5af107353 100644 --- a/src/core-sdk-tasks/GetDependencyInfo.cs +++ b/src/core-sdk-tasks/GetDependencyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.IO; using System.Linq; using System.Xml.Linq; using Microsoft.Build.Framework; @@ -49,6 +48,7 @@ public override bool Execute() { Log.LogWarning($"GetComponentCommit failed for VersionDetailsXmlFile={VersionDetailsXmlFile}, DependencyName={DependencyName}: {ex}"); } + return true; } } diff --git a/src/core-sdk-tasks/GetLinuxNativeInstallerDependencyVersions.cs b/src/core-sdk-tasks/GetLinuxNativeInstallerDependencyVersions.cs index d4f324ce3fba..dda0ffa0c2cb 100644 --- a/src/core-sdk-tasks/GetLinuxNativeInstallerDependencyVersions.cs +++ b/src/core-sdk-tasks/GetLinuxNativeInstallerDependencyVersions.cs @@ -1,14 +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.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -using Newtonsoft.Json.Linq; namespace Microsoft.DotNet.Cli.Build { diff --git a/src/core-sdk-tasks/GetRuntimePackRids.cs b/src/core-sdk-tasks/GetRuntimePackRids.cs index f03128599511..e337ca633855 100644 --- a/src/core-sdk-tasks/GetRuntimePackRids.cs +++ b/src/core-sdk-tasks/GetRuntimePackRids.cs @@ -1,11 +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.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Newtonsoft.Json.Linq; @@ -27,6 +24,7 @@ public override bool Execute() var runtimeJsonRoot = JObject.Parse(runtimeJsonContents); string [] runtimeIdentifiers = ((JObject)runtimeJsonRoot["runtimes"]).Properties().Select(p => p.Name).ToArray(); AvailableRuntimePackRuntimeIdentifiers = runtimeIdentifiers.Select(rid => new TaskItem(rid)).ToArray(); + return true; } } diff --git a/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs b/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs index 06b98573fb7d..f239e0161ad3 100644 --- a/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs +++ b/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -88,39 +87,22 @@ protected override bool ValidateParameters() return retVal; } - public override bool Execute() - { - return base.Execute(); - } + public override bool Execute() => base.Execute(); - protected override string ToolName - { - get { return "tar"; } - } + protected override string ToolName => "tar"; - protected override MessageImportance StandardOutputLoggingImportance - { - get { return MessageImportance.High; } // or else the output doesn't get logged by default - } + protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High; - protected override string GenerateFullPathToTool() - { - return "tar"; - } + protected override string GenerateFullPathToTool() => "tar"; - protected override string GenerateCommandLineCommands() - { - return $"{GetDestinationArchive()} {GetSourceSpecification()}"; - } + protected override string GenerateCommandLineCommands() => $"{GetDestinationArchive()} {GetSourceSpecification()}"; private string GetSourceSpecification() { if (IncludeBaseDirectory) { var parentDirectory = Directory.GetParent(SourceDirectory).Parent.FullName; - var sourceDirectoryName = Path.GetFileName(Path.GetDirectoryName(SourceDirectory)); - return $"--directory {parentDirectory} {sourceDirectoryName} {GetExcludes()}"; } else @@ -129,14 +111,11 @@ private string GetSourceSpecification() } } - private string GetDestinationArchive() - { - return $"-czf {DestinationArchive}"; - } + private string GetDestinationArchive() => $"-czf {DestinationArchive}"; private string GetExcludes() { - var excludes = String.Empty; + var excludes = string.Empty; if (ExcludePatterns != null) { @@ -148,10 +127,7 @@ private string GetExcludes() return excludes; } - - protected override void LogToolCommand(string message) - { - base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}"); - } + + protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); } } diff --git a/src/core-sdk-tasks/UpdateRuntimeConfig.cs b/src/core-sdk-tasks/UpdateRuntimeConfig.cs index 8d8c73c63f9d..3130f5785f6c 100644 --- a/src/core-sdk-tasks/UpdateRuntimeConfig.cs +++ b/src/core-sdk-tasks/UpdateRuntimeConfig.cs @@ -1,10 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Newtonsoft.Json.Linq; diff --git a/src/finalizer/CMakeLists.txt b/src/finalizer/CMakeLists.txt index 17b27a104dc9..63baa941a090 100644 --- a/src/finalizer/CMakeLists.txt +++ b/src/finalizer/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.20) -# Create project named finalizer, this will -# will generate Finalizer.vcxproj +# Create project named finalizer, this will generate Finalizer.vcxproj project(Finalizer) set(CMAKE_MACOSX_RPATH 1) @@ -10,12 +9,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:wmainCRTStartup") -# The WiX SDK is extracted from a NuGet package using an SDK .csproj (finalizer_shim) -# that copies the "lib" and "inc" folders to a stable location. - -include_directories(../../artifacts/WixSdk/inc) -include_directories(../../artifacts/obj) -link_directories(../../artifacts/WixSdk/lib/${Platform}) +# The WiX SDK is extracted from a NuGet package using an SDK .csproj (finalizer-build) that copies the "lib" and "inc" folders to a stable location. +# The defines below (values in ${}) are set in the finalizer.nativeproj. +# See: https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.CMake.Sdk#common-items +# Note: The directory paths use forward slashes because backslashes are escape characters. +include_directories(${ArtifactsDir}WixSdk/inc) +include_directories(${ArtifactsDir}obj) +link_directories(${ArtifactsDir}WixSdk/lib/${Platform}) add_compile_options(/MT) @@ -48,9 +48,7 @@ add_executable(Finalizer native.rc ) -# These are normally part of a .vcxproj in Visual Studio, but -# appears to be missing when CMAKE generates a .vcxproj -# for arm64. +# These are normally part of a .vcxproj in Visual Studio, but appears to be missing when CMAKE generates a .vcxproj for arm64. target_link_libraries(Finalizer shell32.lib) target_link_libraries(Finalizer advapi32.lib) target_link_libraries(Finalizer version.lib) diff --git a/src/finalizer/Directory.Build.props b/src/finalizer/Directory.Build.props new file mode 100644 index 000000000000..f3ea03cfdfd1 --- /dev/null +++ b/src/finalizer/Directory.Build.props @@ -0,0 +1,9 @@ + + + + true + + + + + diff --git a/src/finalizer_shim/finalizer_shim.csproj b/src/finalizer/finalizer-build.csproj similarity index 57% rename from src/finalizer_shim/finalizer_shim.csproj rename to src/finalizer/finalizer-build.csproj index e6cd301f7a46..c30a53bea35c 100644 --- a/src/finalizer_shim/finalizer_shim.csproj +++ b/src/finalizer/finalizer-build.csproj @@ -1,14 +1,11 @@ - - + + - $(Architecture) $(CoreSdkTargetFramework) true false false + $(ArtifactsObjDir)sdk_version.h @@ -17,20 +14,26 @@ - + + - + + + - + - + + + - + + \ No newline at end of file diff --git a/src/finalizer/finalizer.nativeproj b/src/finalizer/finalizer.nativeproj new file mode 100644 index 000000000000..1d6b4c8a5f1a --- /dev/null +++ b/src/finalizer/finalizer.nativeproj @@ -0,0 +1,17 @@ + + + + + $([System.String]::Copy($(ArtifactsDir)).Replace('\','/')) + CMakeLists.txt + + + + + + + + + + + diff --git a/src/finalizer/finalizer.proj b/src/finalizer/finalizer.proj deleted file mode 100644 index 463a37a14abc..000000000000 --- a/src/finalizer/finalizer.proj +++ /dev/null @@ -1,14 +0,0 @@ - - - CMakeLists.txt - - - - - - - - diff --git a/src/redist/targets/packaging/deb/dotnet-debian_config.json b/src/redist/packaging/deb/dotnet-debian_config.json similarity index 77% rename from src/redist/targets/packaging/deb/dotnet-debian_config.json rename to src/redist/packaging/deb/dotnet-debian_config.json index 321892b8fba8..58d9111fa6e3 100644 --- a/src/redist/targets/packaging/deb/dotnet-debian_config.json +++ b/src/redist/packaging/deb/dotnet-debian_config.json @@ -1,34 +1,34 @@ { "maintainer_name":"Microsoft", - "maintainer_email": "dotnetcore@microsoft.com", + "maintainer_email": "dotnetcore@microsoft.com", "package_name": "dotnet-sdk-%SDK_NUGET_VERSION%", "install_root": "/usr/share/dotnet", "short_description": "%CLI_SDK_BRAND_NAME%", - "long_description": ".NET is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.", + "long_description": ".NET is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.", "homepage": "https://github.com/dotnet/core", - "release":{ - "package_version":"0.0.0.0", - "package_revision":"1", - "urgency" : "low", - "changelog_message" : "Bootstrap loop package" + "release": { + "package_version":"0.0.0.0", + "package_revision":"1", + "urgency" : "low", + "changelog_message" : "Bootstrap loop package" }, - "control": { - "priority":"standard", - "section":"devel", - "architecture":"any" + "control": { + "priority":"standard", + "section":"devel", + "architecture":"any" }, "copyright": ".NET Foundation and contributors", - "license": { - "type": "MIT", + "license": { + "type": "MIT", "full_text": "The MIT License (MIT)\nCopyright (c) .NET Foundation and Contributors\n\nAll rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." }, - "debian_dependencies":{ + "debian_dependencies": { "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%": { "package_version": "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_VERSION%" }%SHARED_FRAMEWORK_DEBIAN_PACKAGE_ADDITIONAL_DEPENDENCY%, "%NETCOREAPP_TARGETING_PACK_DEBIAN_PACKAGE_NAME%": { "package_version": "%NETCOREAPP_TARGETING_PACK_DEBIAN_PACKAGE_VERSION%" }, "%NETCORE_APPHOST_PACK_DEBIAN_PACKAGE_NAME%": { "package_version": "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_VERSION%" }, diff --git a/src/redist/targets/packaging/deb/postinst b/src/redist/packaging/deb/postinst similarity index 100% rename from src/redist/targets/packaging/deb/postinst rename to src/redist/packaging/deb/postinst diff --git a/src/redist/targets/packaging/osx/clisdk/Distribution-Template b/src/redist/packaging/osx/Distribution-Template similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/Distribution-Template rename to src/redist/packaging/osx/Distribution-Template diff --git a/src/redist/targets/packaging/osx/clisdk/Distribution-Template-x64 b/src/redist/packaging/osx/Distribution-Template-x64 similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/Distribution-Template-x64 rename to src/redist/packaging/osx/Distribution-Template-x64 diff --git a/src/redist/targets/packaging/osx/clisdk/resources/conclusion.html.lci b/src/redist/packaging/osx/resources/conclusion.html.lci similarity index 93% rename from src/redist/targets/packaging/osx/clisdk/resources/conclusion.html.lci rename to src/redist/packaging/osx/resources/conclusion.html.lci index c52eb575ad8d..6905407c1267 100644 --- a/src/redist/targets/packaging/osx/clisdk/resources/conclusion.html.lci +++ b/src/redist/packaging/osx/resources/conclusion.html.lci @@ -1,5 +1,5 @@  - + diff --git a/src/redist/targets/packaging/osx/clisdk/resources/cs.lproj/conclusion.html b/src/redist/packaging/osx/resources/cs.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/cs.lproj/conclusion.html rename to src/redist/packaging/osx/resources/cs.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/cs.lproj/welcome.html b/src/redist/packaging/osx/resources/cs.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/cs.lproj/welcome.html rename to src/redist/packaging/osx/resources/cs.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/de.lproj/conclusion.html b/src/redist/packaging/osx/resources/de.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/de.lproj/conclusion.html rename to src/redist/packaging/osx/resources/de.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/de.lproj/welcome.html b/src/redist/packaging/osx/resources/de.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/de.lproj/welcome.html rename to src/redist/packaging/osx/resources/de.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/dotnetbackground.png b/src/redist/packaging/osx/resources/dotnetbackground.png similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/dotnetbackground.png rename to src/redist/packaging/osx/resources/dotnetbackground.png diff --git a/src/redist/targets/packaging/osx/clisdk/resources/en.lproj/conclusion.html b/src/redist/packaging/osx/resources/en.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/en.lproj/conclusion.html rename to src/redist/packaging/osx/resources/en.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/en.lproj/welcome.html b/src/redist/packaging/osx/resources/en.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/en.lproj/welcome.html rename to src/redist/packaging/osx/resources/en.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/es.lproj/conclusion.html b/src/redist/packaging/osx/resources/es.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/es.lproj/conclusion.html rename to src/redist/packaging/osx/resources/es.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/es.lproj/welcome.html b/src/redist/packaging/osx/resources/es.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/es.lproj/welcome.html rename to src/redist/packaging/osx/resources/es.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/fr.lproj/conclusion.html b/src/redist/packaging/osx/resources/fr.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/fr.lproj/conclusion.html rename to src/redist/packaging/osx/resources/fr.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/fr.lproj/welcome.html b/src/redist/packaging/osx/resources/fr.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/fr.lproj/welcome.html rename to src/redist/packaging/osx/resources/fr.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/it.lproj/conclusion.html b/src/redist/packaging/osx/resources/it.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/it.lproj/conclusion.html rename to src/redist/packaging/osx/resources/it.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/it.lproj/welcome.html b/src/redist/packaging/osx/resources/it.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/it.lproj/welcome.html rename to src/redist/packaging/osx/resources/it.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ja.lproj/conclusion.html b/src/redist/packaging/osx/resources/ja.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ja.lproj/conclusion.html rename to src/redist/packaging/osx/resources/ja.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ja.lproj/welcome.html b/src/redist/packaging/osx/resources/ja.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ja.lproj/welcome.html rename to src/redist/packaging/osx/resources/ja.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ko.lproj/conclusion.html b/src/redist/packaging/osx/resources/ko.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ko.lproj/conclusion.html rename to src/redist/packaging/osx/resources/ko.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ko.lproj/welcome.html b/src/redist/packaging/osx/resources/ko.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ko.lproj/welcome.html rename to src/redist/packaging/osx/resources/ko.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/pl.lproj/conclusion.html b/src/redist/packaging/osx/resources/pl.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/pl.lproj/conclusion.html rename to src/redist/packaging/osx/resources/pl.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/pl.lproj/welcome.html b/src/redist/packaging/osx/resources/pl.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/pl.lproj/welcome.html rename to src/redist/packaging/osx/resources/pl.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html b/src/redist/packaging/osx/resources/pt-br.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html rename to src/redist/packaging/osx/resources/pt-br.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/pt-br.lproj/welcome.html b/src/redist/packaging/osx/resources/pt-br.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/pt-br.lproj/welcome.html rename to src/redist/packaging/osx/resources/pt-br.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ru.lproj/conclusion.html b/src/redist/packaging/osx/resources/ru.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ru.lproj/conclusion.html rename to src/redist/packaging/osx/resources/ru.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/ru.lproj/welcome.html b/src/redist/packaging/osx/resources/ru.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/ru.lproj/welcome.html rename to src/redist/packaging/osx/resources/ru.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/tr.lproj/conclusion.html b/src/redist/packaging/osx/resources/tr.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/tr.lproj/conclusion.html rename to src/redist/packaging/osx/resources/tr.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/tr.lproj/welcome.html b/src/redist/packaging/osx/resources/tr.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/tr.lproj/welcome.html rename to src/redist/packaging/osx/resources/tr.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/welcome.html.lci b/src/redist/packaging/osx/resources/welcome.html.lci similarity index 92% rename from src/redist/targets/packaging/osx/clisdk/resources/welcome.html.lci rename to src/redist/packaging/osx/resources/welcome.html.lci index c287bd4e087c..b093ceb92583 100644 --- a/src/redist/targets/packaging/osx/clisdk/resources/welcome.html.lci +++ b/src/redist/packaging/osx/resources/welcome.html.lci @@ -1,5 +1,5 @@  - + diff --git a/src/redist/targets/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html b/src/redist/packaging/osx/resources/zh-hans.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html rename to src/redist/packaging/osx/resources/zh-hans.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/zh-hans.lproj/welcome.html b/src/redist/packaging/osx/resources/zh-hans.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/zh-hans.lproj/welcome.html rename to src/redist/packaging/osx/resources/zh-hans.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html b/src/redist/packaging/osx/resources/zh-hant.lproj/conclusion.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html rename to src/redist/packaging/osx/resources/zh-hant.lproj/conclusion.html diff --git a/src/redist/targets/packaging/osx/clisdk/resources/zh-hant.lproj/welcome.html b/src/redist/packaging/osx/resources/zh-hant.lproj/welcome.html similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/resources/zh-hant.lproj/welcome.html rename to src/redist/packaging/osx/resources/zh-hant.lproj/welcome.html diff --git a/src/redist/targets/packaging/osx/clisdk/scripts/postinstall b/src/redist/packaging/osx/scripts/postinstall similarity index 100% rename from src/redist/targets/packaging/osx/clisdk/scripts/postinstall rename to src/redist/packaging/osx/scripts/postinstall diff --git a/src/redist/targets/packaging/rpm/dotnet-config.json b/src/redist/packaging/rpm/dotnet-config.json similarity index 100% rename from src/redist/targets/packaging/rpm/dotnet-config.json rename to src/redist/packaging/rpm/dotnet-config.json diff --git a/src/redist/targets/packaging/rpm/scripts/after_install_host.sh b/src/redist/packaging/rpm/scripts/after_install_host.sh similarity index 100% rename from src/redist/targets/packaging/rpm/scripts/after_install_host.sh rename to src/redist/packaging/rpm/scripts/after_install_host.sh diff --git a/src/redist/targets/packaging/rpm/scripts/after_remove_host.sh b/src/redist/packaging/rpm/scripts/after_remove_host.sh similarity index 100% rename from src/redist/targets/packaging/rpm/scripts/after_remove_host.sh rename to src/redist/packaging/rpm/scripts/after_remove_host.sh diff --git a/src/redist/targets/packaging/rpm/templates/changelog b/src/redist/packaging/rpm/templates/changelog similarity index 100% rename from src/redist/targets/packaging/rpm/templates/changelog rename to src/redist/packaging/rpm/templates/changelog diff --git a/src/redist/targets/packaging/rpm/templates/copyright b/src/redist/packaging/rpm/templates/copyright similarity index 100% rename from src/redist/targets/packaging/rpm/templates/copyright rename to src/redist/packaging/rpm/templates/copyright diff --git a/src/redist/targets/packaging/windows/clisdk/Init.cmd b/src/redist/packaging/windows/Init.cmd similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/Init.cmd rename to src/redist/packaging/windows/Init.cmd diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1028/bundle.wxl b/src/redist/packaging/windows/LCID/1028/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1028/bundle.wxl rename to src/redist/packaging/windows/LCID/1028/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1029/bundle.wxl b/src/redist/packaging/windows/LCID/1029/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1029/bundle.wxl rename to src/redist/packaging/windows/LCID/1029/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1031/bundle.wxl b/src/redist/packaging/windows/LCID/1031/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1031/bundle.wxl rename to src/redist/packaging/windows/LCID/1031/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1033/bundle.wxl b/src/redist/packaging/windows/LCID/1033/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1033/bundle.wxl rename to src/redist/packaging/windows/LCID/1033/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1036/bundle.wxl b/src/redist/packaging/windows/LCID/1036/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1036/bundle.wxl rename to src/redist/packaging/windows/LCID/1036/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1040/bundle.wxl b/src/redist/packaging/windows/LCID/1040/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1040/bundle.wxl rename to src/redist/packaging/windows/LCID/1040/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1041/bundle.wxl b/src/redist/packaging/windows/LCID/1041/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1041/bundle.wxl rename to src/redist/packaging/windows/LCID/1041/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1042/bundle.wxl b/src/redist/packaging/windows/LCID/1042/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1042/bundle.wxl rename to src/redist/packaging/windows/LCID/1042/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1045/bundle.wxl b/src/redist/packaging/windows/LCID/1045/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1045/bundle.wxl rename to src/redist/packaging/windows/LCID/1045/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1046/bundle.wxl b/src/redist/packaging/windows/LCID/1046/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1046/bundle.wxl rename to src/redist/packaging/windows/LCID/1046/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1049/bundle.wxl b/src/redist/packaging/windows/LCID/1049/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1049/bundle.wxl rename to src/redist/packaging/windows/LCID/1049/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/1055/bundle.wxl b/src/redist/packaging/windows/LCID/1055/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/1055/bundle.wxl rename to src/redist/packaging/windows/LCID/1055/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/2052/bundle.wxl b/src/redist/packaging/windows/LCID/2052/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/2052/bundle.wxl rename to src/redist/packaging/windows/LCID/2052/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/LCID/3082/bundle.wxl b/src/redist/packaging/windows/LCID/3082/bundle.wxl similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/LCID/3082/bundle.wxl rename to src/redist/packaging/windows/LCID/3082/bundle.wxl diff --git a/src/redist/targets/packaging/windows/clisdk/StableFileIdForApphostTransform.xslt b/src/redist/packaging/windows/StableFileIdForApphostTransform.xslt similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/StableFileIdForApphostTransform.xslt rename to src/redist/packaging/windows/StableFileIdForApphostTransform.xslt diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec b/src/redist/packaging/windows/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec rename to src/redist/packaging/windows/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec b/src/redist/packaging/windows/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec rename to src/redist/packaging/windows/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec b/src/redist/packaging/windows/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec rename to src/redist/packaging/windows/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.Templates.nuspec b/src/redist/packaging/windows/VS.Redist.Common.NetCore.Templates.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.Templates.nuspec rename to src/redist/packaging/windows/VS.Redist.Common.NetCore.Templates.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.Toolset.nuspec b/src/redist/packaging/windows/VS.Redist.Common.NetCore.Toolset.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.Toolset.nuspec rename to src/redist/packaging/windows/VS.Redist.Common.NetCore.Toolset.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.cxspec b/src/redist/packaging/windows/VS.Tools.Net.Core.SDK.Resolver.cxspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.cxspec rename to src/redist/packaging/windows/VS.Tools.Net.Core.SDK.Resolver.cxspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.nuspec b/src/redist/packaging/windows/VS.Tools.Net.Core.SDK.Resolver.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.nuspec rename to src/redist/packaging/windows/VS.Tools.Net.Core.SDK.Resolver.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.nuspec b/src/redist/packaging/windows/VS.Tools.Net.Core.SDK.nuspec similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.nuspec rename to src/redist/packaging/windows/VS.Tools.Net.Core.SDK.nuspec diff --git a/src/redist/targets/packaging/windows/clisdk/bundle.thm b/src/redist/packaging/windows/bundle.thm similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/bundle.thm rename to src/redist/packaging/windows/bundle.thm diff --git a/src/redist/targets/packaging/windows/clisdk/bundle.wxs b/src/redist/packaging/windows/bundle.wxs similarity index 98% rename from src/redist/targets/packaging/windows/clisdk/bundle.wxs rename to src/redist/packaging/windows/bundle.wxs index f49737a1c0be..50869c45e546 100644 --- a/src/redist/targets/packaging/windows/clisdk/bundle.wxs +++ b/src/redist/packaging/windows/bundle.wxs @@ -133,7 +133,7 @@ Path="[ProgramFiles64Folder]dotnet"/> - - + diff --git a/src/redist/targets/packaging/windows/clisdk/dotnet.wxs b/src/redist/packaging/windows/dotnet.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/dotnet.wxs rename to src/redist/packaging/windows/dotnet.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/dotnethome_x64.wxs b/src/redist/packaging/windows/dotnethome_x64.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/dotnethome_x64.wxs rename to src/redist/packaging/windows/dotnethome_x64.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/dummyeula.rtf b/src/redist/packaging/windows/dummyeula.rtf similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/dummyeula.rtf rename to src/redist/packaging/windows/dummyeula.rtf diff --git a/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 b/src/redist/packaging/windows/generatebundle.ps1 similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 rename to src/redist/packaging/windows/generatebundle.ps1 diff --git a/src/redist/targets/packaging/windows/clisdk/generatemsi.ps1 b/src/redist/packaging/windows/generatemsi.ps1 similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/generatemsi.ps1 rename to src/redist/packaging/windows/generatemsi.ps1 diff --git a/src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 b/src/redist/packaging/windows/generatenupkg.ps1 similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 rename to src/redist/packaging/windows/generatenupkg.ps1 diff --git a/src/redist/targets/packaging/windows/clisdk/generatesdkplaceholdermsi.ps1 b/src/redist/packaging/windows/generatesdkplaceholdermsi.ps1 similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/generatesdkplaceholdermsi.ps1 rename to src/redist/packaging/windows/generatesdkplaceholdermsi.ps1 diff --git a/src/redist/targets/packaging/windows/clisdk/generatetemplatesmsi.ps1 b/src/redist/packaging/windows/generatetemplatesmsi.ps1 similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/generatetemplatesmsi.ps1 rename to src/redist/packaging/windows/generatetemplatesmsi.ps1 diff --git a/src/redist/targets/packaging/windows/clisdk/manifests.wxs b/src/redist/packaging/windows/manifests.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/manifests.wxs rename to src/redist/packaging/windows/manifests.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/msi b/src/redist/packaging/windows/msi similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/msi rename to src/redist/packaging/windows/msi diff --git a/src/redist/targets/packaging/windows/clisdk/msi.ico b/src/redist/packaging/windows/msi.ico similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/msi.ico rename to src/redist/packaging/windows/msi.ico diff --git a/src/redist/targets/packaging/windows/clisdk/provider.wxs b/src/redist/packaging/windows/provider.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/provider.wxs rename to src/redist/packaging/windows/provider.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/registrykeys.wxs b/src/redist/packaging/windows/registrykeys.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/registrykeys.wxs rename to src/redist/packaging/windows/registrykeys.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/sdkplaceholder.wxs b/src/redist/packaging/windows/sdkplaceholder.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/sdkplaceholder.wxs rename to src/redist/packaging/windows/sdkplaceholder.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/templates.wxs b/src/redist/packaging/windows/templates.wxs similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/templates.wxs rename to src/redist/packaging/windows/templates.wxs diff --git a/src/redist/targets/packaging/windows/clisdk/variables.wxi b/src/redist/packaging/windows/variables.wxi similarity index 100% rename from src/redist/targets/packaging/windows/clisdk/variables.wxi rename to src/redist/packaging/windows/variables.wxi diff --git a/src/redist/projects/DownloadPackage.csproj b/src/redist/projects/DownloadPackage.csproj new file mode 100644 index 000000000000..c918ab88b6c6 --- /dev/null +++ b/src/redist/projects/DownloadPackage.csproj @@ -0,0 +1,25 @@ + + + + + false + true + true + + + + + + + + + + + + + diff --git a/src/SdkResolver/SdkResolver.csproj b/src/redist/projects/SdkResolver.csproj similarity index 91% rename from src/SdkResolver/SdkResolver.csproj rename to src/redist/projects/SdkResolver.csproj index 6b7d8821adb7..20cc676ca76b 100644 --- a/src/SdkResolver/SdkResolver.csproj +++ b/src/redist/projects/SdkResolver.csproj @@ -1,4 +1,4 @@ - + $(CoreSdkTargetFramework) @@ -6,7 +6,6 @@ false false false - UNUSED true @@ -17,11 +16,7 @@ - + diff --git a/src/VSTemplateLocator/VSTemplateLocator.csproj b/src/redist/projects/VSTemplateLocator.csproj similarity index 92% rename from src/VSTemplateLocator/VSTemplateLocator.csproj rename to src/redist/projects/VSTemplateLocator.csproj index 63733576a040..aac68bf20f20 100644 --- a/src/VSTemplateLocator/VSTemplateLocator.csproj +++ b/src/redist/projects/VSTemplateLocator.csproj @@ -1,4 +1,4 @@ - + $(CoreSdkTargetFramework) @@ -6,7 +6,6 @@ false false false - UNUSED true @@ -18,11 +17,7 @@ - + diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index b0335d8c310a..c76d94d56013 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -1,5 +1,6 @@ - - + + + $(CoreSdkTargetFramework) true false @@ -11,22 +12,14 @@ - + - - + + - - - - - - + @@ -42,7 +35,6 @@ - @@ -51,4 +43,5 @@ + diff --git a/src/redist/targets/Badge.targets b/src/redist/targets/Badge.targets index e7878902650d..ee8bc27b3fb4 100644 --- a/src/redist/targets/Badge.targets +++ b/src/redist/targets/Badge.targets @@ -1,5 +1,5 @@ - - + + $(RepoRoot)/resources/images/version_badge.svg @@ -29,4 +29,5 @@ $(ArtifactsShippingPackagesDir)$(VersionBadgeMoniker)_$(Configuration)_coherent_badge.svg + diff --git a/src/redist/targets/Branding.targets b/src/redist/targets/Branding.targets index 6b6e2642b9e4..be143b87a468 100644 --- a/src/redist/targets/Branding.targets +++ b/src/redist/targets/Branding.targets @@ -1,4 +1,5 @@ + cli @@ -15,5 +16,5 @@ $(SharedFrameworkName) - + diff --git a/src/redist/targets/BuildCoreSdkTasks.targets b/src/redist/targets/BuildCoreSdkTasks.targets index 1ebfc9457a49..ff3cf1bef71b 100644 --- a/src/redist/targets/BuildCoreSdkTasks.targets +++ b/src/redist/targets/BuildCoreSdkTasks.targets @@ -1,4 +1,5 @@ + $(CoreSdkTargetFramework) @@ -7,35 +8,36 @@ $(ArtifactsDir)tasks\bin\core-sdk-tasks\$(Configuration)\$(TaskTargetFramework)\core-sdk-tasks.dll $(RepoRoot)src\core-sdk-tasks\core-sdk-tasks.csproj + + Targets="Restore" /> + Properties="ArtifactsDir=$(ArtifactsDir)tasks\" /> - - + + - - + + - - + + - - - - - + + + + + diff --git a/src/redist/targets/BundledDotnetTools.targets b/src/redist/targets/BundledDotnetTools.targets index 75bb0e21380d..a09b18ec1c81 100644 --- a/src/redist/targets/BundledDotnetTools.targets +++ b/src/redist/targets/BundledDotnetTools.targets @@ -1,4 +1,5 @@ - + + @@ -15,20 +16,28 @@ - - + + PackageToRestore=%(BundledDotnetTool.Identity); PackageVersionToRestore=%(BundledDotnetTool.Version); - RestoreProjectStyle=DotnetToolReference; TargetFramework=$(TargetFramework); - LayoutFolder=$(SdkOutputDirectory)DotnetTools/ + RestoreProjectStyle=DotnetToolReference + + + + + + + diff --git a/src/redist/targets/BundledManifests.targets b/src/redist/targets/BundledManifests.targets index fbe03b6e48d9..47e21e1406e0 100644 --- a/src/redist/targets/BundledManifests.targets +++ b/src/redist/targets/BundledManifests.targets @@ -1,7 +1,9 @@ - + + 8.0.100 + @@ -38,13 +40,13 @@ - + [%(Version)] - + - + [%(Version)] @@ -53,7 +55,6 @@ - $(PkgMicrosoft_DotNet_SignCheck)\tools\Microsoft.DotNet.SignCheck.exe $(ArtifactsLogDir)\workloadmanifestsigncheck.log @@ -66,7 +67,7 @@ Exclude="Microsoft.NET.Workload.Mono.ToolChain.Current;Microsoft.NET.Workload.Mono.ToolChain.net6;Microsoft.NET.Workload.Mono.ToolChain.net7;Microsoft.NET.Workload.Mono.ToolChain.net8;Microsoft.NET.Workload.Emscripten.Current;Microsoft.NET.Workload.Emscripten.net6;Microsoft.NET.Workload.Emscripten.net7;Microsoft.NET.Workload.Emscripten.net8;Microsoft.NET.Sdk.Aspire"> $([MSBuild]::NormalizePath($([System.IO.Directory]::GetFiles('%(RestoredMsiNupkgContentPath)/data/', '*$(MsiArchitectureForWorkloadManifests).msi')))) - + @@ -85,28 +86,26 @@ - - + WorkloadManifestId="%(Identity)" /> + DestinationPath="%(BundledManifests.FeatureBand)/$([MSBuild]::ValueOrDefault('%(Identity)', '').ToLower())/%(BundledManifests.Version)/localize" /> - + + DestinationFolder="$(RedistLayoutPath)sdk-manifests/%(DestinationPath)" /> $(VersionPrefix)-baseline$(_BuildNumberLabels) @@ -119,10 +118,11 @@ - + + diff --git a/src/redist/targets/BundledTemplates.targets b/src/redist/targets/BundledTemplates.targets index 22a21f3d6a80..bbe1dd1373fc 100644 --- a/src/redist/targets/BundledTemplates.targets +++ b/src/redist/targets/BundledTemplates.targets @@ -1,6 +1,6 @@ - - + + $(ArtifactsNonShippingPackagesDir)%(TemplatesComponents.TemplateBaseFilename)-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension) - @@ -48,7 +47,7 @@ - + @@ -67,13 +66,13 @@ - + - - - + + + @@ -114,16 +113,15 @@ $(TemplatePackageDownloadProjectDirectory)TemplatePackageDownloader.csproj - + + Targets="Restore" /> - @@ -135,7 +133,7 @@ + Condition="'%(BundledTemplatesWithInstallPaths.TemplateFrameworkVersion)' == '9.0'" /> - + DestinationFolder="$(BaseOutputPath)$(Configuration)\templates-%(BundledTemplatesWithInstallPaths.TemplateFrameworkVersion)\templates/%(BundledTemplatesWithInstallPaths.BundledTemplateInstallPath)" /> diff --git a/src/redist/targets/Checksum.targets b/src/redist/targets/Checksum.targets index b10b125b7866..82c0db2cadaa 100644 --- a/src/redist/targets/Checksum.targets +++ b/src/redist/targets/Checksum.targets @@ -1,5 +1,5 @@ - - + + + diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets index f7a8cd5cd77c..8d388f17e932 100644 --- a/src/redist/targets/Crossgen.targets +++ b/src/redist/targets/Crossgen.targets @@ -1,10 +1,10 @@ + - microsoft.netcore.app.runtime.$(SharedFrameworkRid) microsoft.netcore.app.crossgen2.$(Crossgen2Rid) @@ -17,7 +17,7 @@ - + PackageToRestore=$(RuntimeNETCrossgenPackageName); PackageVersionToRestore=$(MicrosoftNETCoreAppRuntimePackageVersion); @@ -69,7 +69,6 @@ - @@ -97,7 +96,6 @@ - @@ -133,7 +131,6 @@ Remove the following 2 lines when resolving this issue: https://github.com/dotnet/core-sdk/issues/6877 --> - @@ -143,19 +140,19 @@ false - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/redist/targets/DownloadPackage.csproj b/src/redist/targets/DownloadPackage.csproj deleted file mode 100644 index d9af49574f6f..000000000000 --- a/src/redist/targets/DownloadPackage.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Library - false - true - true - - - - - - - - - - - - - diff --git a/src/redist/targets/FileExtensions.targets b/src/redist/targets/FileExtensions.targets index d2691675009b..bdbbd62afc29 100644 --- a/src/redist/targets/FileExtensions.targets +++ b/src/redist/targets/FileExtensions.targets @@ -1,4 +1,5 @@ + .tar.gz @@ -26,7 +27,7 @@ .sh .ps1 - + diff --git a/src/redist/targets/GenerateArchives.targets b/src/redist/targets/GenerateArchives.targets index ac662ab94c6c..fac4b4b9bde8 100644 --- a/src/redist/targets/GenerateArchives.targets +++ b/src/redist/targets/GenerateArchives.targets @@ -1,8 +1,8 @@ + - @@ -25,7 +25,8 @@ SourceDirectory="$(RedistLayoutPath)" DestinationArchive="$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk).tar.gz" OverwriteDestination="true" - IgnoreExitCode="$(IgnoreTarExitCode)"/> + IgnoreExitCode="$(IgnoreTarExitCode)" /> + diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index a182db24e414..e44349ae7b73 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -2,7 +2,7 @@ + DependsOnTargets="GenerateBundledVersionsProps;GenerateBundledCliToolsProps;GenerateBundledMSBuildProps"> + Encoding="ASCII" /> + %24([MSBuild]::NormalizePath('%24(MSBuildThisFileDirectory)..\..\')) %24([MSBuild]::EnsureTrailingSlash('%24(NetCoreRoot)'))packs @@ -534,7 +532,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_NETCoreSdkIsPreview>$(_NETCoreSdkBeingBuiltIsPreview) - @(ImplicitPackageVariable->'', ' + @(ImplicitPackageVariable->'', ' ') @@ -693,7 +691,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + @@ -1104,7 +1102,6 @@ Copyright (c) .NET Foundation. All rights reserved. RuntimePackRuntimeIdentifiers="@(AspNetCore31RuntimePackRids, '%3B')" /> - <_ExcludedKnownRuntimeIdentiferPlatforms Include="@(_ExcludedKnownRuntimeIdentiferPlatforms, '%3B')" /> + ]]> @@ -1234,9 +1232,11 @@ Copyright (c) .NET Foundation. All rights reserved. *********************************************************************************************** --> + @(BundledDotnetTools->HasMetadata('ObsoletesCliTool')->' %3CBundledDotNetCliToolReference Include="%(ObsoletesCliTool)" /%3E','%0A') + ]]> @@ -1304,7 +1304,7 @@ Copyright (c) .NET Foundation. All rights reserved. + SkipUnchangedFiles="true" /> + RuntimeIdentifierChainOutputPath="$(SdkOutputDirectory)NETCoreSdkRuntimeIdentifierChain.txt" /> + diff --git a/src/redist/targets/GenerateDebs.targets b/src/redist/targets/GenerateDebs.targets index f0e7e5d14506..1cccb4fd0fa2 100644 --- a/src/redist/targets/GenerateDebs.targets +++ b/src/redist/targets/GenerateDebs.targets @@ -1,10 +1,9 @@ - - + $(PkgMicrosoft_DotNet_Build_Tasks_Installers)/build/deb-package-tool - + + GenerateDebsInner" /> + Outputs="@(GeneratedInstallers)" /> @@ -209,10 +208,10 @@ + PropertyName="AspNetCoreSharedFxBaseRuntimeVersion" /> - + $(AspNetCoreSharedFxBaseRuntimeVersion.IndexOf('-')) @@ -232,113 +231,113 @@ DependsOnTargets="PrepareDotnetDebDirectories; GetAspNetSharedFxInstallArgs;" Inputs="@(CLISdkFiles);@(TemplatesFiles);@(ManifestFiles)" - Outputs="$(SdkDebInstallerFile)" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Outputs="$(SdkDebInstallerFile)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Outputs="$(DebianTestResultsXmlFile)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -426,22 +424,23 @@ - - - - - - - - - - - false - - - - + + + + + + + + + + + false + + + + + diff --git a/src/redist/targets/GenerateInstallers.targets b/src/redist/targets/GenerateInstallers.targets index b98fcc9d17ce..9f6f455e8904 100644 --- a/src/redist/targets/GenerateInstallers.targets +++ b/src/redist/targets/GenerateInstallers.targets @@ -14,4 +14,5 @@ GenerateRpms; GenerateDebs" /> + diff --git a/src/redist/targets/GenerateLayout.targets b/src/redist/targets/GenerateLayout.targets index 7d090d6ac8dd..0615d9eb62c7 100644 --- a/src/redist/targets/GenerateLayout.targets +++ b/src/redist/targets/GenerateLayout.targets @@ -1,4 +1,5 @@ + $(BaseOutputPath)$(Configuration)\dotnet\ $(BaseOutputPath)$(Configuration)\internal\ @@ -352,7 +353,6 @@ $(DownloadedWinFormsAndWpfSharedFrameworkInstallerFileName) - @@ -403,17 +403,16 @@ - - + PackageToRestore=%(BundledLayoutPackage.PackageName); PackageVersionToRestore=%(BundledLayoutPackage.PackageVersion); - TargetFramework=%(BundledLayoutPackage.TargetFramework); - LayoutPackageDescription=%(BundledLayoutPackage.Identity) + TargetFramework=%(BundledLayoutPackage.TargetFramework) @@ -447,7 +446,7 @@ - + @@ -460,13 +459,12 @@ + DirectoriesToCopy="%(BundledLayoutComponent.DirectoriesToCopy)" /> - @@ -493,8 +491,7 @@ Overwrite="true" /> - - + @@ -518,7 +515,6 @@ - Microsoft.NETCore.App.Host.$(SharedFrameworkRid) $(IntermediateOutputPath)AppHostRestore\ @@ -529,7 +525,7 @@ - + PackageToRestore=$(NETCoreAppHostPackageName); PackageVersionToRestore=$(MicrosoftNETCoreAppHostPackageVersion); @@ -550,7 +546,7 @@ + Condition="'%(FileName)%(Extension)' == '$(AppHostExecutableName)'" /> - @@ -598,24 +593,21 @@ LayoutAppHostTemplate; GeneratePrecomputedRarCache; ReplaceBundledRuntimePackFilesWithSymbolicLinks" - BeforeTargets="AfterBuild"> - - + BeforeTargets="AfterBuild" /> - - + - + DestinationFiles="@(SdkInternalFiles -> '$(SdkInternalLayoutPath)sdk\$(Version)\%(RecursiveDir)%(Filename)%(Extension)')" /> + diff --git a/src/redist/targets/GenerateMSBuildExtensions.targets b/src/redist/targets/GenerateMSBuildExtensions.targets index 5392ff556b23..470c3d473d3a 100644 --- a/src/redist/targets/GenerateMSBuildExtensions.targets +++ b/src/redist/targets/GenerateMSBuildExtensions.targets @@ -1,4 +1,5 @@ + $(BaseOutputPath)$(Configuration)\MSBuildExtensionsLayout\ @@ -13,9 +14,9 @@ - - - + + + @@ -29,14 +30,14 @@ package and inserted into Visual Studio --> + DeploymentSubpath="msbuildExtensions/" /> + DeploymentSubpath="msbuildExtensions-ver/" /> @@ -58,4 +59,5 @@ + diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 41d2c7820370..9cc8c914a662 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -1,5 +1,5 @@ - - + + @@ -13,31 +13,34 @@ $(ArtifactsTmpDir)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)-engine.exe - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatemsi.ps1 - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatesdkplaceholdermsi.ps1 - $(MSBuildThisFileDirectory)packaging/windows/clisdk/stablefileidforapphosttransform.xslt - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatebundle.ps1 - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatenupkg.ps1 + $(MSBuildThisFileDirectory)../packaging/windows + $(SdkPkgSourcesRootDirectory)/generatemsi.ps1 + $(SdkPkgSourcesRootDirectory)/generatesdkplaceholdermsi.ps1 + $(SdkPkgSourcesRootDirectory)/stablefileidforapphosttransform.xslt + $(SdkPkgSourcesRootDirectory)/generatebundle.ps1 + $(SdkPkgSourcesRootDirectory)/generatenupkg.ps1 $(ArtifactsDir)bin/finalizer/$(Architecture)/$(Configuration)/bin/finalizer.exe - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.Toolset.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Redist.Common.NetCore.Toolset.nuspec $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.Toolset.$(Architecture).$(FullNugetVersion).nupkg - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.SdkPlaceholder.$(Architecture).$(FullNugetVersion).nupkg - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Tools.Net.Core.SDK.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Tools.Net.Core.SDK.nuspec $(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg - $(ArtifactsDir)bin/SdkResolver/$(Configuration) - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.nuspec + + $(ArtifactsDir)bin/SdkResolver/Debug + $(SdkPkgSourcesRootDirectory)/VS.Tools.Net.Core.SDK.Resolver.nuspec $(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.Resolver.nupkg - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.$(FullNugetVersion).nupkg $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr + $(ArtifactsDir)bin/VSTemplateLocator/Debug - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.$(FullNugetVersion).nupkg @@ -121,14 +124,13 @@ DependsOnTargets="SetupWixProperties;MsiTargetsSetupInputOutputs" Inputs="$(WixDownloadSentinel)" Outputs="$(WixDestinationPath)"> - + Encoding="Unicode" /> - - - + AdditionalBasePaths="$(SdkPkgSourcesRootDirectory)"> @@ -225,7 +224,6 @@ Condition="$(ProductMonikerRid.StartsWith('win')) And '$(Architecture)' != 'arm'" Inputs="@(TemplatesMsiComponent);$(TemplatesGenerateMsiPowershellScript)" Outputs="%(TemplatesMsiComponent.MSIInstallerFile)"> - - - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatetemplatesmsi.ps1 + $(SdkPkgSourcesRootDirectory)/generatetemplatesmsi.ps1 @@ -312,19 +309,18 @@ BeforeTargets="GenerateSdkBundle" Condition=" '$(OS)' == 'Windows_NT' " Outputs="$(MinimumVSVersion)"> + + %(SDKInternalFiles.Identity) + - - %(SDKInternalFiles.Identity) - - - - - + + + - - $(MinimumVSVersion.Substring(0,$(MinimumVSVersion.LastIndexOf('.')))) - $([MSBuild]::Add($(MinimumVSVersion), .1)) - + + $(MinimumVSVersion.Substring(0,$(MinimumVSVersion.LastIndexOf('.')))) + $([MSBuild]::Add($(MinimumVSVersion), .1)) + - @(LatestTemplateInstallerComponent->'%(MSIInstallerFile)') - + + AdditionalBasePaths="$(SdkPkgSourcesRootDirectory)"> @@ -405,7 +400,6 @@ $(ToolsetInstallerNuspecFile); $(GenerateNupkgPowershellScript)" Outputs="$(ToolsetInstallerNupkgFile)"> - - - - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.Templates.nuspec + $(SdkPkgSourcesRootDirectory)/VS.Redist.Common.NetCore.Templates.nuspec @@ -463,7 +455,6 @@ %(TemplatesMajorMinorVersion) - - - - + OutputFile="$(SdkMSBuildExtensionsSwrFile)" /> @@ -519,7 +507,6 @@ '$(FullNugetVersion)' ^ '$(SdkMSBuildExtensionsNuspecFile)' ^ '$(SdkMSBuildExtensionsNupkgFile)'" /> - - - - diff --git a/src/redist/targets/GeneratePKG.targets b/src/redist/targets/GeneratePKG.targets index 9886c88c8fe2..decdeb32333b 100644 --- a/src/redist/targets/GeneratePKG.targets +++ b/src/redist/targets/GeneratePKG.targets @@ -1,4 +1,5 @@ + $(IntermediateOutputPath)pkgs/$(Version) @@ -16,7 +17,7 @@ /usr/local/share/dotnet /usr/local/share/dotnet/x64 - $(MSBuildThisFileDirectory)packaging/osx/clisdk + $(MSBuildThisFileDirectory)../packaging/osx $(SdkPkgSourcesRootDirectory)/scripts $(SdkPkgScriptsDirectory)/postinstall $(PkgIntermediateDirectory)/scripts @@ -39,204 +40,203 @@ $(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension) - - - - - $(SharedFrameworkComponentId) - - - $(NetCoreAppTargetingPackComponentId) - - - $(NetStandardTargetingPackComponentId) - - - $(NetCoreAppHostPackComponentId) - - - $(SharedHostComponentId) - - - $(HostFxrComponentId) - - - $(SdkComponentId) - - - $(Version) - - - $(SdkBrandName) - - - $(SharedFrameworkBrandName) - - - $(NetCoreAppTargetingPackBrandName) - - - $(NetCoreAppHostPackBrandName) - - - $(NetStandardTargetingPackBrandName) - - - $(SharedHostBrandName) - - - $(HostFxrBrandName) - - - $(Architecture) - - - $(Architecture) - x86_64 - - - - 10.15 - 11.0 - - - $(x64EmulationPkgInstallDirectory) - - - - $(Version) - - - - $(Version) - - - $(MicrosoftNETCoreAppRuntimePackageVersion) - - - $(MicrosoftAspNetCoreAppRuntimePackageVersion) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + $(SharedFrameworkComponentId) + + + $(NetCoreAppTargetingPackComponentId) + + + $(NetStandardTargetingPackComponentId) + + + $(NetCoreAppHostPackComponentId) + + + $(SharedHostComponentId) + + + $(HostFxrComponentId) + + + $(SdkComponentId) + + + $(Version) + + + $(SdkBrandName) + + + $(SharedFrameworkBrandName) + + + $(NetCoreAppTargetingPackBrandName) + + + $(NetCoreAppHostPackBrandName) + + + $(NetStandardTargetingPackBrandName) + + + $(SharedHostBrandName) + + + $(HostFxrBrandName) + + + $(Architecture) + + + $(Architecture) + x86_64 + + + + 10.15 + 11.0 + + + $(x64EmulationPkgInstallDirectory) + + + + $(Version) + + + + $(Version) + + + $(MicrosoftNETCoreAppRuntimePackageVersion) + + + $(MicrosoftAspNetCoreAppRuntimePackageVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/redist/targets/GenerateRPMs.targets b/src/redist/targets/GenerateRPMs.targets index a82f068fcb12..6130c8c6238c 100644 --- a/src/redist/targets/GenerateRPMs.targets +++ b/src/redist/targets/GenerateRPMs.targets @@ -2,12 +2,11 @@ rpm_config.json - $(MSBuildThisFileDirectory)packaging/rpm/templates - $(MSBuildThisFileDirectory)packaging/rpm/scripts + $(MSBuildThisFileDirectory)../packaging/rpm/templates + $(MSBuildThisFileDirectory)../packaging/rpm/scripts after_install_host.sh - @@ -15,73 +14,73 @@ + Outputs="@(GeneratedInstallers)" /> + Condition=" '$(IsRPMBasedDistro)' == 'True' and '$(FPMPresent)' == 'True' " /> - - + + - - - - - - - - + + + + + + + + - + - - - + + + + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> @@ -149,7 +148,6 @@ - @@ -164,7 +162,7 @@ + ReplacementItems="@(AfterInstallHostTokenValue)" /> + ReplacementItems="@(SDKTokenValue)" /> - + - + - - + + - + + UseHardlinksIfPossible="False" /> + UseHardlinksIfPossible="False" /> - + UseHardlinksIfPossible="False" /> $(RepoRoot)/Documentation/manpages $(RepoRoot)/test/EndToEnd/EndToEnd.csproj - $(MSBuildThisFileDirectory)packaging/rpm/dotnet-config.json + $(MSBuildThisFileDirectory)../packaging/rpm/dotnet-config.json $(IntermediateOutputPath)$(SdkRpmPackageName)/$(RpmPackageVersion) $(RpmIntermediatesDir)/rpm-testResults.xml /usr/share/dotnet @@ -295,11 +292,10 @@ - - + @@ -311,7 +307,7 @@ + Importance="High" /> + Outputs="$(RpmTestResultsXmlFile)"> @@ -362,4 +358,5 @@ + diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets index 39f89415f47e..e05828c83ea9 100644 --- a/src/redist/targets/GetRuntimeInformation.targets +++ b/src/redist/targets/GetRuntimeInformation.targets @@ -1,4 +1,5 @@ + @@ -52,7 +53,7 @@ $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)-cm.1-$(InstallerTargetArchitecture) $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)-cm.2-$(InstallerTargetArchitecture) - + diff --git a/src/redist/targets/LayoutTool.csproj b/src/redist/targets/LayoutTool.csproj deleted file mode 100644 index 1ce7612ba842..000000000000 --- a/src/redist/targets/LayoutTool.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - Library - false - - - - - - - - - - $([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)/$(PackageToRestore)/$(PackageVersionToRestore)')) - - - - - - - - - diff --git a/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets b/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets index 82482b22af15..79941d045bf0 100644 --- a/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets +++ b/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets @@ -1,5 +1,5 @@ - + @@ -31,4 +31,5 @@ + diff --git a/src/redist/targets/SetBuildDefaults.targets b/src/redist/targets/SetBuildDefaults.targets index c9ea44707689..5e6a4bd729b1 100644 --- a/src/redist/targets/SetBuildDefaults.targets +++ b/src/redist/targets/SetBuildDefaults.targets @@ -1,4 +1,5 @@ + @@ -32,4 +33,5 @@ %3b + diff --git a/src/redist/targets/Versions.targets b/src/redist/targets/Versions.targets index 405bd9a3e7fa..d71565b42805 100644 --- a/src/redist/targets/Versions.targets +++ b/src/redist/targets/Versions.targets @@ -1,4 +1,5 @@ + $(VersionPrefix)-$(PreReleaseVersionLabel) @@ -6,4 +7,5 @@ $(FullNugetVersion).$(VersionSuffixDateStamp).$(VersionSuffixBuildOfTheDay) + diff --git a/test/EndToEnd/EndToEnd.Tests.csproj b/test/EndToEnd/EndToEnd.Tests.csproj index 278ac08fd3f6..22cf49211956 100644 --- a/test/EndToEnd/EndToEnd.Tests.csproj +++ b/test/EndToEnd/EndToEnd.Tests.csproj @@ -1,4 +1,5 @@  + $(CoreSdkTargetFramework) $(DefineConstants);LINUX_PORTABLE @@ -22,5 +23,6 @@ PreserveNewest - + + diff --git a/test/EndToEnd/GivenDotNetLinuxInstallers.cs b/test/EndToEnd/GivenDotNetLinuxInstallers.cs index 4968f0221fcb..1eba2dc51baf 100644 --- a/test/EndToEnd/GivenDotNetLinuxInstallers.cs +++ b/test/EndToEnd/GivenDotNetLinuxInstallers.cs @@ -31,8 +31,7 @@ public void ItHasExpectedDependencies() } } - private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) - { + private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) => // Example output: // $ dpkg --info dotnet-sdk-2.1.105-ubuntu-x64.deb @@ -58,10 +57,8 @@ private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string .Should().Pass() .And.HaveStdOutMatching(@"Depends:.*\s?dotnet-runtime-\d+(\.\d+){2}") .And.HaveStdOutMatching(@"Depends:.*\s?aspnetcore-store-\d+(\.\d+){2}"); - } - private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) - { + private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) => // Example output: // $ rpm -qpR dotnet-sdk-2.1.105-rhel-x64.rpm @@ -78,6 +75,5 @@ private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string ins .Should().Pass() .And.HaveStdOutMatching(@"dotnet-runtime-\d+(\.\d+){2} >= \d+(\.\d+){2}") .And.HaveStdOutMatching(@"aspnetcore-store-\d+(\.\d+){2} >= \d+(\.\d+){2}"); - } } } diff --git a/test/EndToEnd/GivenDotnetUsesDotnetTools.cs b/test/EndToEnd/GivenDotnetUsesDotnetTools.cs index 3e32c4a45c40..cfdf5d590b1c 100644 --- a/test/EndToEnd/GivenDotnetUsesDotnetTools.cs +++ b/test/EndToEnd/GivenDotnetUsesDotnetTools.cs @@ -1,17 +1,13 @@ using FluentAssertions; using Microsoft.DotNet.Tools.Test.Utilities; -using Xunit; namespace EndToEnd { public class GivenDotnetUsesDotnetTools : TestBase { [RequiresAspNetCore] - public void ThenOneDotnetToolsCanBeCalled() - { - new DotnetCommand() + public void ThenOneDotnetToolsCanBeCalled() => new DotnetCommand() .ExecuteWithCapturedOutput("dev-certs --help") .Should().Pass(); - } } } diff --git a/test/EndToEnd/GivenFrameworkDependentApps.cs b/test/EndToEnd/GivenFrameworkDependentApps.cs index 9e0677e6c240..1e3d0d80656e 100644 --- a/test/EndToEnd/GivenFrameworkDependentApps.cs +++ b/test/EndToEnd/GivenFrameworkDependentApps.cs @@ -40,10 +40,7 @@ public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreApp(string minorVe [Theory] [ClassData(typeof(SupportedAspNetCoreAllVersions))] - public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreAll(string minorVersion) - { - ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAllPackageName, minorVersion); - } + public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreAll(string minorVersion) => ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAllPackageName, minorVersion); internal void ItDoesNotRollForwardToTheLatestVersion(string packageName, string minorVersion) { @@ -87,13 +84,10 @@ internal void ItDoesNotRollForwardToTheLatestVersion(string packageName, string #endif } - private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) - { - return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null) + private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) => lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null) ?.Libraries?.SingleOrDefault(l => string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0) ?.Version; - } public string GetExpectedVersion(string packageName, string minorVersion) { diff --git a/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs b/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs index 97398a685ad6..7401426ad04f 100644 --- a/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs +++ b/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs @@ -1,10 +1,7 @@ using FluentAssertions; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; -using System; -using System.Collections.Generic; using System.IO; -using System.Text; namespace EndToEnd { diff --git a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs index 297dfd1d56bf..6c81606279c6 100644 --- a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs +++ b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs @@ -92,13 +92,10 @@ internal void ItRollsForwardToTheLatestVersion(string packageName, string minorV "needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)"); } - private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) - { - return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) + private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) => lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) ?.Libraries?.SingleOrDefault(l => string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0) ?.Version; - } [Fact] public void WeCoverLatestNetCoreAppRollForward() diff --git a/test/EndToEnd/GivenUnixPlatform.cs b/test/EndToEnd/GivenUnixPlatform.cs index bb93b72fee60..690e1530e4db 100644 --- a/test/EndToEnd/GivenUnixPlatform.cs +++ b/test/EndToEnd/GivenUnixPlatform.cs @@ -1,7 +1,3 @@ -using System; -using System.IO; -using System.Linq; -using System.Xml.Linq; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; diff --git a/test/EndToEnd/GivenWeWantToRequireWindowsForDesktopApps.cs b/test/EndToEnd/GivenWeWantToRequireWindowsForDesktopApps.cs index 5f67ba6880d2..be6110b23402 100644 --- a/test/EndToEnd/GivenWeWantToRequireWindowsForDesktopApps.cs +++ b/test/EndToEnd/GivenWeWantToRequireWindowsForDesktopApps.cs @@ -1,7 +1,6 @@ // 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.IO; using System.Xml.Linq; using EndToEnd; diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index e4a5bf3b8b4b..da0893539b32 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -191,10 +191,7 @@ public void ItCanPublishArm64Wpf(string TargetFramework, bool selfContained) [InlineData("nunit")] [InlineData("web")] [InlineData("mvc")] - public void ItCanBuildTemplates(string templateName, string language = "") - { - TestTemplateCreateAndBuild(templateName, language: language); - } + public void ItCanBuildTemplates(string templateName, string language = "") => TestTemplateCreateAndBuild(templateName, language: language); /// /// The test checks if dotnet new shows curated list correctly after the SDK installation and template insertion. @@ -309,25 +306,16 @@ public void ItCanCreateItemTemplateWithProjectRestriction(string templateName, s [WindowsOnlyTheory] [InlineData("wpf")] [InlineData("winforms")] - public void ItCanBuildDesktopTemplates(string templateName) - { - TestTemplateCreateAndBuild(templateName); - } + public void ItCanBuildDesktopTemplates(string templateName) => TestTemplateCreateAndBuild(templateName); [WindowsOnlyTheory] [InlineData("wpf")] - public void ItCanBuildDesktopTemplatesSelfContained(string templateName) - { - TestTemplateCreateAndBuild(templateName, selfContained: true); - } + public void ItCanBuildDesktopTemplatesSelfContained(string templateName) => TestTemplateCreateAndBuild(templateName, selfContained: true); [Theory] [InlineData("web")] [InlineData("console")] - public void ItCanBuildTemplatesSelfContained(string templateName) - { - TestTemplateCreateAndBuild(templateName, selfContained: true); - } + public void ItCanBuildTemplatesSelfContained(string templateName) => TestTemplateCreateAndBuild(templateName, selfContained: true); /// /// The test checks if the template creates the template for correct framework by default. diff --git a/test/EndToEnd/TestProjectCreator.cs b/test/EndToEnd/TestProjectCreator.cs index 2455192abe69..8e1eb339ac5e 100644 --- a/test/EndToEnd/TestProjectCreator.cs +++ b/test/EndToEnd/TestProjectCreator.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; -using System.Text; using System.Xml.Linq; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; @@ -80,7 +79,6 @@ public TestAssetInstance Create() project.Save(projectPath); return testInstance; - } } } diff --git a/test/EndToEnd/VersionTests.cs b/test/EndToEnd/VersionTests.cs index c8b53c6bed89..9c73efdfbfd1 100644 --- a/test/EndToEnd/VersionTests.cs +++ b/test/EndToEnd/VersionTests.cs @@ -1,9 +1,6 @@ -using System; -using System.IO; +using System.IO; using System.Linq; -using System.Xml.Linq; using FluentAssertions; -using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultExtensions.cs index ad3bf23c3fa3..4cd8b0cfeae1 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultExtensions.cs @@ -7,9 +7,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities { public static class CommandResultExtensions { - public static CommandResultAssertions Should(this CommandResult commandResult) - { - return new CommandResultAssertions(commandResult); - } + public static CommandResultAssertions Should(this CommandResult commandResult) => new CommandResultAssertions(commandResult); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs index adb83caf28c2..f17a4bc309fc 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs @@ -3,12 +3,10 @@ using FluentAssertions; using FluentAssertions.Execution; -using Microsoft.DotNet.Cli.Utils; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoExtensions.cs index fedc70850248..e5dc6418e7ad 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoExtensions.cs @@ -1,39 +1,20 @@ // 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.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { public static class DirectoryInfoExtensions { - public static DirectoryInfoAssertions Should(this DirectoryInfo dir) - { - return new DirectoryInfoAssertions(dir); - } + public static DirectoryInfoAssertions Should(this DirectoryInfo dir) => new DirectoryInfoAssertions(dir); - public static DirectoryInfo Sub(this DirectoryInfo dir, string name) - { - return new DirectoryInfo(Path.Combine(dir.FullName, name)); - } + public static DirectoryInfo Sub(this DirectoryInfo dir, string name) => new DirectoryInfo(Path.Combine(dir.FullName, name)); - public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) - { - return target.FullName.StartsWith(subject.FullName); - } + public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) => target.FullName.StartsWith(subject.FullName); - public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string [] directoryNames) - { - return new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames))); - } + public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string[] directoryNames) => new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames))); - public static FileInfo GetFile(this DirectoryInfo subject, string fileName) - { - return new FileInfo(Path.Combine(subject.FullName, fileName)); - } + public static FileInfo GetFile(this DirectoryInfo subject, string fileName) => new FileInfo(Path.Combine(subject.FullName, fileName)); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoAssertions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoAssertions.cs index dca27f0c52c4..49f2f0037e83 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoAssertions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoAssertions.cs @@ -3,12 +3,7 @@ using FluentAssertions; using FluentAssertions.Execution; -using Microsoft.DotNet.Cli.Utils; -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoLock.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoLock.cs index 5f2325ef6ecd..af9428feca75 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoLock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoLock.cs @@ -2,10 +2,7 @@ // 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.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { @@ -20,10 +17,7 @@ public FileInfoLock(FileInfo fileInfo) _fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); } - public void Dispose() - { - _fileStream.Dispose(); - } + public void Dispose() => _fileStream.Dispose(); } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoNuGetLock.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoNuGetLock.cs index 490ec76505c0..d0fd7d3ee741 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoNuGetLock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.FileInfoNuGetLock.cs @@ -2,9 +2,7 @@ // 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.Threading; using System.Threading.Tasks; using NuGet.Common; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.cs index ccf3bf84289a..21bae6bbcb3f 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/FileInfoExtensions.cs @@ -2,33 +2,18 @@ // 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.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { public static partial class FileInfoExtensions { - public static FileInfoAssertions Should(this FileInfo file) - { - return new FileInfoAssertions(file); - } + public static FileInfoAssertions Should(this FileInfo file) => new FileInfoAssertions(file); - public static IDisposable Lock(this FileInfo subject) - { - return new FileInfoLock(subject); - } + public static IDisposable Lock(this FileInfo subject) => new FileInfoLock(subject); - public static IDisposable NuGetLock(this FileInfo subject) - { - return new FileInfoNuGetLock(subject); - } + public static IDisposable NuGetLock(this FileInfo subject) => new FileInfoNuGetLock(subject); - public static string ReadAllText(this FileInfo subject) - { - return File.ReadAllText(subject.FullName); - } + public static string ReadAllText(this FileInfo subject) => File.ReadAllText(subject.FullName); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/StringAssertionsExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/StringAssertionsExtensions.cs index e0483c39a4b0..ad32d79b80f2 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/StringAssertionsExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/StringAssertionsExtensions.cs @@ -1,7 +1,6 @@ // 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 FluentAssertions; using FluentAssertions.Execution; using FluentAssertions.Primitives; @@ -10,10 +9,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities { public static class StringAssertionsExtensions { - private static string NormalizeLineEndings(string s) - { - return s.Replace("\r\n", "\n"); - } + private static string NormalizeLineEndings(string s) => s.Replace("\r\n", "\n"); public static AndConstraint BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs) { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs index e657e324ca79..2461e7f6c90e 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs @@ -12,19 +12,10 @@ public class BufferedReporter : IReporter public void WriteLine(string format, params object?[] args) => WriteLine(string.Format(format, args)); - public void WriteLine(string message) - { - Lines.Add(message); - } + public void WriteLine(string message) => Lines.Add(message); - public void WriteLine() - { - Lines.Add(""); - } + public void WriteLine() => Lines.Add(""); - public void Write(string message) - { - throw new NotImplementedException(); - } + public void Write(string message) => throw new NotImplementedException(); } } \ No newline at end of file diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs index 838597d8648d..a1d08145754d 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs @@ -12,7 +12,7 @@ public sealed class AddReferenceCommand : DotnetCommand public override CommandResult Execute(string args = "") { args = $"add {_projectName} reference {args}"; - return base.ExecuteWithCapturedOutput(args); + return ExecuteWithCapturedOutput(args); } public AddReferenceCommand WithProject(string projectName) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildServerCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildServerCommand.cs index 98658718812f..4636426899f3 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildServerCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildServerCommand.cs @@ -7,14 +7,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities { public sealed class BuildServerCommand : DotnetCommand { - public override CommandResult Execute(string args = "") - { - return base.Execute($"build-server {args}"); - } + public override CommandResult Execute(string args = "") => base.Execute($"build-server {args}"); - public override CommandResult ExecuteWithCapturedOutput(string args = "") - { - return base.ExecuteWithCapturedOutput($"build-server {args}"); - } + public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"build-server {args}"); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs index 61d44dbf56cf..e504b88e5c48 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using Microsoft.DotNet.Cli.Utils; -using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs index 3952f6e08ac1..2dc14cae019b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using Microsoft.DotNet.Cli.Utils; -using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs index d94f5f814c31..ca633000676e 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs @@ -1,8 +1,6 @@ // 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 Microsoft.DotNet.Cli.Utils; - namespace Microsoft.DotNet.Tools.Test.Utilities { public class DotnetCommand : TestCommand diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs index 222d923684f0..a816d97cdb63 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs @@ -7,19 +7,10 @@ namespace Microsoft.DotNet.Tools.Test.Utilities { public sealed class HelpCommand : DotnetCommand { - public override CommandResult Execute(string args = "") - { - return base.Execute(AppendHelp(args)); - } + public override CommandResult Execute(string args = "") => base.Execute(AppendHelp(args)); - public override CommandResult ExecuteWithCapturedOutput(string args = "") - { - return base.ExecuteWithCapturedOutput(AppendHelp(args)); - } + public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput(AppendHelp(args)); - private string AppendHelp(string args) - { - return args = $"help {args}"; - } + private string AppendHelp(string args) => args = $"help {args}"; } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListPackageCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListPackageCommand.cs index fba6d712a04a..6b186966b37f 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListPackageCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListPackageCommand.cs @@ -12,7 +12,7 @@ public sealed class ListPackageCommand : DotnetCommand public override CommandResult Execute(string args = "") { args = $"list {_path} package {args}"; - return base.ExecuteWithCapturedOutput(args); + return ExecuteWithCapturedOutput(args); } public ListPackageCommand WithPath(string path) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs index 4d7cb5b3513d..796a2b9dd606 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs @@ -12,7 +12,7 @@ public sealed class ListReferenceCommand : DotnetCommand public override CommandResult Execute(string args = "") { args = $"list {_projectName} reference {args}"; - return base.ExecuteWithCapturedOutput(args); + return ExecuteWithCapturedOutput(args); } public ListReferenceCommand WithProject(string projectName) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs index 8a6e28dcb144..32441783fee3 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.DotNet.Cli.Utils; -using Xunit; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs index f18af106ab86..495ea0b0b04b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities @@ -16,64 +15,28 @@ public sealed class PackCommand : DotnetCommand private string _versionSuffix; private bool _serviceable; - private string OutputOption - { - get - { - return _outputDirectory == string.Empty ? + private string OutputOption => _outputDirectory == string.Empty ? "" : $"-o \"{_outputDirectory}\""; - } - } - private string BuildBasePathOption - { - get - { - return _buildBasePath == string.Empty ? + private string BuildBasePathOption => _buildBasePath == string.Empty ? "" : $"-b \"{_buildBasePath}\""; - } - } - private string TempOutputOption - { - get - { - return _tempOutputDirectory == string.Empty ? + private string TempOutputOption => _tempOutputDirectory == string.Empty ? "" : $"-t {_tempOutputDirectory}"; - } - } - private string ConfigurationOption - { - get - { - return _configuration == string.Empty ? + private string ConfigurationOption => _configuration == string.Empty ? "" : $"-c {_configuration}"; - } - } - private string VersionSuffixOption - { - get - { - return _versionSuffix == string.Empty ? + private string VersionSuffixOption => _versionSuffix == string.Empty ? "" : $"--version-suffix {_versionSuffix}"; - } - } - private string ServiceableOption - { - get - { - return _serviceable ? + private string ServiceableOption => _serviceable ? $"--serviceable" : ""; - } - } public PackCommand WithConfiguration(string configuration) { @@ -112,9 +75,6 @@ public override CommandResult ExecuteWithCapturedOutput(string args = "") return base.ExecuteWithCapturedOutput(args); } - private string BuildArgs() - { - return $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}"; - } + private string BuildArgs() => $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}"; } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs index ada6a80be098..fd39bb6bf68d 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs @@ -21,10 +21,7 @@ public PublishCommand WithFramework(string framework) return this; } - public PublishCommand WithFramework(NuGetFramework framework) - { - return WithFramework(framework.GetShortFolderName()); - } + public PublishCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName()); public PublishCommand WithOutput(string output) { @@ -62,15 +59,12 @@ public override CommandResult ExecuteWithCapturedOutput(string args = "") return base.ExecuteWithCapturedOutput(args); } - private string BuildArgs() - { - return string.Join(" ", + private string BuildArgs() => string.Join(" ", FrameworkOption, OutputOption, TargetOption, RuntimeOption, SelfContainedOption); - } private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs index 66c7b9bc4118..6e33f1538fc9 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs @@ -12,7 +12,7 @@ public sealed class RemoveReferenceCommand : DotnetCommand public override CommandResult Execute(string args = "") { args = $"remove {_projectName} reference {args}"; - return base.ExecuteWithCapturedOutput(args); + return ExecuteWithCapturedOutput(args); } public RemoveReferenceCommand WithProject(string projectName) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs index 81349a6c664a..2cbfeabc8cef 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using Microsoft.DotNet.Cli.Utils; -using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/StoreCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/StoreCommand.cs index a933a043b6af..65e52876139b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/StoreCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/StoreCommand.cs @@ -28,10 +28,7 @@ public StoreCommand WithFramework(string framework) return this; } - public StoreCommand WithFramework(NuGetFramework framework) - { - return WithFramework(framework.GetShortFolderName()); - } + public StoreCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName()); public StoreCommand WithOutput(string output) { @@ -69,16 +66,13 @@ public override CommandResult ExecuteWithCapturedOutput(string args = "") return base.ExecuteWithCapturedOutput(args); } - private string BuildArgs() - { - return string.Join(" ", + private string BuildArgs() => string.Join(" ", ProfileProjectOption, FrameworkOption, OutputOption, IntermediateWorkingDirectoryOption, RuntimeOption, FrameworkVersionOption); - } private string ProfileProjectOption => string.Join(" ", _profileProject) ; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs index 0ac0ce5cf2c2..82ff520dfc36 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs @@ -6,9 +6,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Threading; using System.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities @@ -48,10 +45,7 @@ public void KillTree() CurrentProcess.KillTree(); } - public virtual CommandResult Execute(string args = "") - { - return Task.Run(async () => await ExecuteAsync(args)).Result; - } + public virtual CommandResult Execute(string args = "") => Task.Run(async () => await ExecuteAsync(args)).Result; public async virtual Task ExecuteAsync(string args = "") { @@ -77,9 +71,9 @@ public virtual CommandResult ExecuteWithCapturedOutput(string args = "") private async Task ExecuteAsyncInternal(string executable, string args) { - var stdOut = new List(); + var stdOut = new List(); - var stdErr = new List(); + var stdErr = new List(); CurrentProcess = CreateProcess(executable, args); @@ -124,8 +118,8 @@ private async Task ExecuteAsyncInternal(string executable, string return new CommandResult( CurrentProcess.StartInfo, CurrentProcess.ExitCode, - String.Join(System.Environment.NewLine, stdOut), - String.Join(System.Environment.NewLine, stdErr)); + string.Join(System.Environment.NewLine, stdOut), + string.Join(System.Environment.NewLine, stdErr)); } private Process CreateProcess(string executable, string args) @@ -194,14 +188,12 @@ private void RemoveNullTerminator(List strings) } } - private string GetBaseDirectory() - { + private string GetBaseDirectory() => #if NET451 - return AppDomain.CurrentDomain.BaseDirectory; + AppDomain.CurrentDomain.BaseDirectory; #else - return AppContext.BaseDirectory; + AppContext.BaseDirectory; #endif - } private void ResolveCommand(ref string executable, ref string args) { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ToolCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ToolCommand.cs index 3a3589f730d7..d9099cd32fc6 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ToolCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ToolCommand.cs @@ -7,14 +7,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities { public sealed class ToolCommand : DotnetCommand { - public override CommandResult Execute(string args = "") - { - return base.Execute($"tool {args}"); - } + public override CommandResult Execute(string args = "") => base.Execute($"tool {args}"); - public override CommandResult ExecuteWithCapturedOutput(string args = "") - { - return base.ExecuteWithCapturedOutput($"tool {args}"); - } + public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"tool {args}"); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs index edcb9071f2af..7366a4153ae4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs @@ -7,20 +7,11 @@ namespace Microsoft.DotNet.TestFramework { internal static class DirectoryInfoExtensions { - public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) - { - return target.FullName.StartsWith(subject.FullName); - } + public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) => target.FullName.StartsWith(subject.FullName); - public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string [] directoryNames) - { - return new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames))); - } + public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string[] directoryNames) => new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames))); - public static FileInfo GetFile(this DirectoryInfo subject, string fileName) - { - return new FileInfo(Path.Combine(subject.FullName, fileName)); - } + public static FileInfo GetFile(this DirectoryInfo subject, string fileName) => new FileInfo(Path.Combine(subject.FullName, fileName)); public static void EnsureExistsAndEmpty(this DirectoryInfo subject) { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/ProcessExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/ProcessExtensions.cs index 565cac435248..26287171a89c 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/ProcessExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/ProcessExtensions.cs @@ -19,10 +19,7 @@ internal static class ProcessExtensions #endif private static readonly TimeSpan _defaultTimeout = TimeSpan.FromSeconds(30); - public static void KillTree(this Process process) - { - process.KillTree(_defaultTimeout); - } + public static void KillTree(this Process process) => process.KillTree(_defaultTimeout); public static void KillTree(this Process process, TimeSpan timeout) { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/TestCommandExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/TestCommandExtensions.cs index ca69106bd543..f8254f3a7dc7 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/TestCommandExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/TestCommandExtensions.cs @@ -1,13 +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 Microsoft.DotNet.Cli.Utils; using System; -using System.Diagnostics; using System.IO; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Threading.Tasks; namespace Microsoft.DotNet.Tools.Test.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/NuGetFrameworks.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/NuGetFrameworks.cs index a7ad2fa18e3f..bdbafc8158ff 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/NuGetFrameworks.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/NuGetFrameworks.cs @@ -1,7 +1,5 @@ using NuGet.Frameworks; using System; -using System.Collections.Generic; -using System.Text; namespace Microsoft.DotNet.Tools.Tests.Utilities { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs index f8ab797b40d6..4546a34c688e 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using FluentAssertions; @@ -12,7 +13,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities public class RepoDirectoriesProvider { public readonly static string RepoRoot; - public readonly static string TestWorkingFolder; public readonly static string DotnetUnderTest; public readonly static string DotnetRidUnderTest; @@ -55,20 +55,17 @@ static RepoDirectoriesProvider() } else { - string configuration = new DirectoryInfo(AppContext.BaseDirectory).Parent.Name; + // https://stackoverflow.com/a/60545278/294804 + var assemblyConfigurationAttribute = typeof(RepoDirectoriesProvider).Assembly.GetCustomAttribute(); + string configuration = assemblyConfigurationAttribute?.Configuration; DotnetUnderTest = Path.Combine(RepoRoot, "artifacts", "bin", "redist", configuration, "dotnet", "dotnet" + dotnetExtension); } } - string AspNetCoreDir = Path.Combine( - Path.GetDirectoryName(DotnetUnderTest), - "shared", - "Microsoft.AspNetCore.App"); - + string AspNetCoreDir = Path.Combine(Path.GetDirectoryName(DotnetUnderTest), "shared", "Microsoft.AspNetCore.App"); if (Directory.Exists(AspNetCoreDir)) { - Stage2AspNetCore = - Directory.EnumerateDirectories(AspNetCoreDir).First(); + Stage2AspNetCore = Directory.EnumerateDirectories(AspNetCoreDir).First(); } // TODO: Resolve dotnet folder even if DotnetUnderTest doesn't have full path @@ -81,6 +78,5 @@ static RepoDirectoriesProvider() var lines = File.ReadAllLines(versionFile); DotnetRidUnderTest = lines[2].Trim(); } - } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RuntimeConfig.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RuntimeConfig.cs index e161dba3bcfd..1bc7043482eb 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/RuntimeConfig.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RuntimeConfig.cs @@ -4,7 +4,6 @@ using System; using System.Text.Json; using System.IO; -using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.TestFramework { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs index e2e63d4a69ce..73c34e6411c2 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs @@ -12,7 +12,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities /// internal static class FileNameUtilities { - private const string DirectorySeparatorStr = "\\"; internal const char DirectorySeparatorChar = '\\'; internal const char AltDirectorySeparatorChar = '/'; internal const char VolumeSeparatorChar = ':'; @@ -25,10 +24,7 @@ internal static class FileNameUtilities /// /// True if is a simple file name, false if it is null or includes a directory specification. /// - internal static bool IsFileName(string path) - { - return IndexOfFileName(path) == 0; - } + internal static bool IsFileName(string path) => IndexOfFileName(path) == 0; /// /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/ImmutableArrayTestExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/ImmutableArrayTestExtensions.cs index f7ffe420f32e..c9c1eb591dc9 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/ImmutableArrayTestExtensions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/ImmutableArrayTestExtensions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/PathUtilities.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/PathUtilities.cs index e1cfbffb6615..e27f30c8e595 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/PathUtilities.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/PathUtilities.cs @@ -19,18 +19,9 @@ internal static class PathUtilities internal static readonly string DirectorySeparatorStr = new string(DirectorySeparatorChar, 1); internal const char VolumeSeparatorChar = ':'; - private static bool IsUnixLikePlatform - { - get - { - return Path.DirectorySeparatorChar == '/'; - } - } + private static bool IsUnixLikePlatform => Path.DirectorySeparatorChar == '/'; - internal static bool IsDirectorySeparator(char c) - { - return c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; - } + internal static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; internal static string TrimTrailingSeparators(string s) { @@ -48,25 +39,13 @@ internal static string TrimTrailingSeparators(string s) return s; } - internal static string GetExtension(string path) - { - return FileNameUtilities.GetExtension(path); - } + internal static string GetExtension(string path) => FileNameUtilities.GetExtension(path); - internal static string ChangeExtension(string path, string extension) - { - return FileNameUtilities.ChangeExtension(path, extension); - } + internal static string ChangeExtension(string path, string extension) => FileNameUtilities.ChangeExtension(path, extension); - internal static string RemoveExtension(string path) - { - return FileNameUtilities.ChangeExtension(path, extension: null); - } + internal static string RemoveExtension(string path) => FileNameUtilities.ChangeExtension(path, extension: null); - internal static string GetFileName(string path) - { - return FileNameUtilities.GetFileName(path); - } + internal static string GetFileName(string path) => FileNameUtilities.GetFileName(path); /// /// Get directory name from path. diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempDirectory.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempDirectory.cs index 0e6e07d90f5e..46c048163a84 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempDirectory.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempDirectory.cs @@ -42,12 +42,9 @@ private static string CreateUniqueDirectory(string basePath) } } } - - public string Path - { - get { return _path; } - } - + + public string Path => _path; + public DirectoryInfo DirectoryInfo => new DirectoryInfo(Path); /// @@ -108,14 +105,8 @@ public TempDirectory CreateDirectory(string name) return new TempDirectory(dirPath, _root); } - public void SetCurrentDirectory() - { - Directory.SetCurrentDirectory(_path); - } - - public override string ToString() - { - return _path; - } + public void SetCurrentDirectory() => Directory.SetCurrentDirectory(_path); + + public override string ToString() => _path; } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempFile.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempFile.cs index 541987880e4c..6b328e7d419f 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempFile.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempFile.cs @@ -50,17 +50,11 @@ internal TempFile(string prefix, string extension, string directory, string call } } } - - public FileStream Open(FileAccess access = FileAccess.ReadWrite) - { - return new FileStream(_path, FileMode.Open, access); - } - - public string Path - { - get { return _path; } - } - + + public FileStream Open(FileAccess access = FileAccess.ReadWrite) => new FileStream(_path, FileMode.Open, access); + + public string Path => _path; + public TempFile WriteAllText(string content, Encoding encoding) { File.WriteAllText(_path, content, encoding); @@ -82,12 +76,9 @@ public async Task WriteAllTextAsync(string content, Encoding encoding) return this; } - - public Task WriteAllTextAsync(string content) - { - return WriteAllTextAsync(content, Encoding.UTF8); - } - + + public Task WriteAllTextAsync(string content) => WriteAllTextAsync(content, Encoding.UTF8); + public TempFile WriteAllBytes(byte[] content) { File.WriteAllBytes(_path, content); @@ -99,20 +90,11 @@ public TempFile WriteAllBytes(ImmutableArray content) content.WriteToFile(_path); return this; } - - public string ReadAllText() - { - return File.ReadAllText(_path); - } - - public TempFile CopyContentFrom(string path) - { - return WriteAllBytes(File.ReadAllBytes(path)); - } - - public override string ToString() - { - return _path; - } + + public string ReadAllText() => File.ReadAllText(_path); + + public TempFile CopyContentFrom(string path) => WriteAllBytes(File.ReadAllBytes(path)); + + public override string ToString() => _path; } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempRoot.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempRoot.cs index 58e426b47f9e..f74611188ea2 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempRoot.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/TempRoot.cs @@ -61,12 +61,9 @@ public DisposableDirectory CreateDirectory() _temps.Add(dir); return dir; } - - public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath]string callerSourcePath = null, [CallerLineNumber]int callerLineNumber = 0) - { - return AddFile(new DisposableFile(prefix, extension, directory, callerSourcePath, callerLineNumber)); - } - + + public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath] string callerSourcePath = null, [CallerLineNumber] int callerLineNumber = 0) => AddFile(new DisposableFile(prefix, extension, directory, callerSourcePath, callerLineNumber)); + public DisposableFile AddFile(DisposableFile file) { _temps.Add(file); diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs index 15693244c3cb..6de2d1442826 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs @@ -68,10 +68,7 @@ internal IEnumerable GetSourceFiles() .Where(f => !FilesToExclude.Contains(f.Name)); } - private DirectoryInfo GetTestDestinationDirectory(string callingMethod, string identifier) - { - return _testAssets.CreateTestDirectory(AssetName, callingMethod, identifier); - } + private DirectoryInfo GetTestDestinationDirectory(string callingMethod, string identifier) => _testAssets.CreateTestDirectory(AssetName, callingMethod, identifier); private void ThrowIfTestAssetDoesNotExist() { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs index 0912ae58b978..78574eb8ae51 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs @@ -4,11 +4,8 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Reflection; -using System.Runtime.CompilerServices; using System.Text; -using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.Common; @@ -129,10 +126,7 @@ public TestAssetInstance WithEmptyGlobalJson() return this; } - public TestAssetInstance WithProjectChanges(Action xmlAction) - { - return WithProjectChanges((path, project) => xmlAction(project)); - } + public TestAssetInstance WithProjectChanges(Action xmlAction) => WithProjectChanges((path, project) => xmlAction(project)); public TestAssetInstance WithProjectChanges(Action xmlAction) { @@ -211,10 +205,7 @@ private void CopyNugetConfigAdjustingPath(FileInfo source, FileInfo destination) } } - private IEnumerable GetProjectFiles() - { - return Root.GetFiles(TestAssetInfo.ProjectFilePattern, SearchOption.AllDirectories); - } + private IEnumerable GetProjectFiles() => Root.GetFiles(TestAssetInfo.ProjectFilePattern, SearchOption.AllDirectories); private void Restore(FileInfo projectFile) { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs index 8e2e2987a2f0..cd3e5acacc35 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs @@ -1,13 +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.Collections.Generic; using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.TestFramework { @@ -73,17 +68,11 @@ public TestAssetInventoryFiles(DirectoryInfo inventoryFileDirectory) Build = new FileInfo(Path.Combine(inventoryFileDirectory.FullName, "build.txt")); } - public IEnumerable AllInventoryFiles - { - get - { - return new List + public IEnumerable AllInventoryFiles => new List { Source, Restore, Build }; - } - } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs index 80835f2bb5e0..ada0fa9a0609 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs @@ -1,14 +1,6 @@ // 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.CompilerServices; -using System.Threading.Tasks; -using Microsoft.DotNet.Cli.Utils; - namespace Microsoft.DotNet.TestFramework { public class TestAssetKinds diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs index 8b66b6ac5c66..4e154e15cedf 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs @@ -2,12 +2,8 @@ // 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.CompilerServices; -using System.Threading.Tasks; -using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.TestFramework { @@ -49,19 +45,13 @@ public TestAssets(DirectoryInfo assetsRoot, FileInfo dotnetCsprojExe, string tes _testWorkingFolder = testWorkingFolder; } - public TestAssetInfo Get(string name) - { - return Get(TestAssetKinds.TestProjects, name); - } + public TestAssetInfo Get(string name) => Get(TestAssetKinds.TestProjects, name); public TestAssetInfo Get(string kind, string name) { var assetDirectory = new DirectoryInfo(Path.Combine(_root.FullName, kind, name)); - return new TestAssetInfo( - assetDirectory, - name, - this); + return new TestAssetInfo(assetDirectory, name, this); } public DirectoryInfo CreateTestDirectory(string testProjectName = "", [CallerMemberName] string callingMethod = "", string identifier = "") diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs index f45b57e4a1bd..c6c0e3240bcd 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs @@ -6,13 +6,11 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Threading.Tasks; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.TestFramework; namespace Microsoft.DotNet.Tools.Test.Utilities { - /// /// Base class for all unit test classes. /// @@ -34,13 +32,7 @@ static TestBase() } } - protected static string RepoRoot - { - get - { - return RepoDirectoriesProvider.RepoRoot; - } - } + protected static string RepoRoot => RepoDirectoriesProvider.RepoRoot; public static TestAssets TestAssets { @@ -53,7 +45,7 @@ public static TestAssets TestAssets s_testAssets = new TestAssets( new DirectoryInfo(assetsRoot), new FileInfo(RepoDirectoriesProvider.DotnetUnderTest), - RepoDirectoriesProvider.TestWorkingFolder); + RepoDirectoriesProvider.TestWorkingFolder); } return s_testAssets; @@ -64,10 +56,7 @@ protected TestBase() { } - public static string GetUniqueName() - { - return Guid.NewGuid().ToString("D"); - } + public static string GetUniqueName() => Guid.NewGuid().ToString("D"); public TempRoot Temp { @@ -132,15 +121,9 @@ protected void TestOutputExecutable( string outputDir, string executableName, string expectedOutput, - bool native = false) - { - TestExecutable(GetCompilationOutputPath(outputDir, native), executableName, expectedOutput); - } + bool native = false) => TestExecutable(GetCompilationOutputPath(outputDir, native), executableName, expectedOutput); - protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput) - { - TestOutputExecutable(outputDir, executableName, expectedOutput, true); - } + protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput) => TestOutputExecutable(outputDir, executableName, expectedOutput, true); protected string GetCompilationOutputPath(string outputDir, bool native) { diff --git a/test/SdkTests/SdkTests.csproj b/test/SdkTests/SdkTests.csproj index 9c7f538aac5d..dfdb8aaa2207 100644 --- a/test/SdkTests/SdkTests.csproj +++ b/test/SdkTests/SdkTests.csproj @@ -11,14 +11,12 @@ true true - + $(MSBuildToolsPath)\Microsoft.CSharp.targets - false - false $(CoreSdkTargetFramework) @@ -46,9 +44,8 @@ - - + + @@ -66,19 +63,19 @@ - - + $(DotnetToTestPath)%(RecursiveDir)%(Filename)%(Extension) + + SkipUnchangedFiles="true" /> $(DotnetToTestPath)shared\Microsoft.NETCore.App\$(RuntimeVersionToInstall) + @@ -101,6 +99,7 @@ $(InstallRuntimeCommand) -Architecture '$(Architecture)' $(InstallRuntimeCommand) }" + /bin/bash $(InstallRuntimeCommand) "$(DotNetRoot)dotnet-install.sh" @@ -112,8 +111,7 @@ + IgnoreStandardErrorWarningFormat="true" /> @@ -121,8 +119,7 @@ + SkipUnchangedFiles="true" /> @@ -137,9 +134,7 @@ - + @@ -152,11 +147,10 @@ ToolTestName=%(SdkTest.Identity) - - + + - + testSdk$(ToolTestName) @@ -166,7 +160,6 @@ - @@ -177,26 +170,21 @@ $(ToolRunPrefix)unset MSBuildSDKsPath DOTNET_HOST_PATH DOTNET_INSTALLDIR && - + + WorkingDirectory="$(TestLocalToolFolder)" + EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)" + IgnoreStandardErrorWarningFormat="true" /> $(MicrosoftNETSdkPackageVersion) - $(RedistLayoutPath)dotnet tool install --local $(ToolCommandName) $(InstallToolCommand) --version $(SdkTestPackageVersion) - - - + EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)" /> $(ArtifactsTestResultsDir)$(TestProjectName).xml @@ -223,26 +211,26 @@ $(TestArgs) -testConfigFile "$(MSBuildThisFileDirectory)TestsToSkipx86.xml" - + $(TestArgs) -testConfigFile "$(MSBuildThisFileDirectory)TestsToSkipPortableLinux.xml" - + $(TestArgs) -testConfigFile "$(MSBuildThisFileDirectory)TestsToSkipLinux.xml" - + $(TestArgs) -testConfigFile "$(MSBuildThisFileDirectory)TestsToSkipOSX.xml" + EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)" /> - + @@ -254,11 +242,6 @@ - - - - - @@ -267,12 +250,10 @@ - - - + - + diff --git a/test/SdkTests/TestConfig.xml b/test/SdkTests/TestConfig.xml index f5b3aa5233c6..5dc6368a5515 100644 --- a/test/SdkTests/TestConfig.xml +++ b/test/SdkTests/TestConfig.xml @@ -37,7 +37,6 @@ - diff --git a/test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs b/test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs index 29c56731fec7..f0463b8f9b3c 100644 --- a/test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs +++ b/test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs @@ -11,10 +11,10 @@ public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVe { var result = CalculateTemplateVersions.Calculate("3.1.0"); - result.Should() - .Be(("3.1.1", "3.1", "3.1.1"), - "the patch is 1 higher than aspnetTemplateVersion " + - "due to https://github.com/dotnet/core-sdk/issues/6243"); + // The patch is 1 higher than aspnetTemplateVersion due to https://github.com/dotnet/core-sdk/issues/6243 + result.InstallPath.Should().Be("3.1.1"); + result.MajorMinorVersion.Should().Be("3.1"); + result.MajorMinorPatchVersion.Should().Be("3.1.1"); } [Fact] @@ -22,8 +22,9 @@ public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVe { var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6"); - result.Should() - .Be(("3.0.1-alpha.1.20071.6", "3.0", "3.0.1")); + result.InstallPath.Should().Be("3.0.1-alpha.1.20071.6"); + result.MajorMinorVersion.Should().Be("3.0"); + result.MajorMinorPatchVersion.Should().Be("3.0.1"); } [Fact] @@ -31,10 +32,10 @@ public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateV { var result = CalculateTemplateVersions.Calculate("5.1.0"); - result.Should() - .Be(("5.1.0", "5.1", "5.1.0"), - "the patch align with AspNetCoreTemplateMajorVersion again, " + - "since there is no non-deterministic existing ComponentId under Major version 5."); + // The patch align with AspNetCoreTemplateMajorVersion again, since there is no non-deterministic existing ComponentId under Major version 5. + result.InstallPath.Should().Be("5.1.0"); + result.MajorMinorVersion.Should().Be("5.1"); + result.MajorMinorPatchVersion.Should().Be("5.1.0"); } [Fact] @@ -42,8 +43,9 @@ public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateV { var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6"); - result.Should() - .Be(("5.0.0-alpha.1.20071.6", "5.0", "5.0.0")); + result.InstallPath.Should().Be("5.0.0-alpha.1.20071.6"); + result.MajorMinorVersion.Should().Be("5.0"); + result.MajorMinorPatchVersion.Should().Be("5.0.0"); } } }