From 84866105e751b590937c2d86db2597cd38c5a413 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 15 Dec 2025 13:32:04 +0100 Subject: [PATCH 01/12] Use NET=Runtime on tasks and delete .NET Framework task implementations By using `NET="Runtime"` on UsingTask declarations, msbuild runs the task always on .NETCoreApp, even on desktop msbuild. Delete two unused projects: - IssueManager (not used in dnceng anymore) - Microsoft.DotNet.Tar (was only necessary for desktop SignTool) --- Arcade.slnx | 2 - eng/BuildTask.Packages.props | 22 --- eng/BuildTask.targets | 41 +----- ...et.SwaggerGenerator.MSBuild.InTree.targets | 10 +- src/Common/Internal/AssemblyResolution.cs | 57 -------- src/Common/Internal/AssemblyResolver.cs | 110 --------------- src/Common/Internal/BuildTask.Desktop.cs | 13 -- .../MSBuildTaskBase.Desktop.cs | 14 -- .../Microsoft.Arcade.Common.csproj | 13 +- .../Microsoft.Arcade.Test.Common.csproj | 6 +- .../Microsoft.Cci.Extensions.csproj | 15 +- .../Microsoft.DotNet.Arcade.Sdk.csproj | 11 +- .../src/DownloadFile.cs | 4 - .../src/GetLicenseFilePath.cs | 11 +- .../src/InstallDotNetCore.cs | 7 - .../src/SetCorFlags.cs | 13 -- src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs | 13 -- .../tools/BuildReleasePackages.targets | 5 +- .../tools/BuildTasks.props | 3 +- .../tools/GenerateChecksums.targets | 2 +- .../tools/GenerateResxSource.targets | 2 +- .../tools/InstallDotNetCore.targets | 2 +- .../tools/OptimizationData.targets | 6 +- .../tools/Publish.proj | 2 +- .../tools/RepositoryInfo.targets | 2 +- .../tools/RepositoryValidation.proj | 4 +- .../SdkTasks/CreateBaselineUpdatePR.proj | 2 +- .../tools/SdkTasks/PublishBuildAssets.proj | 2 +- ...VisualStudio.BuildIbcTrainingSettings.proj | 4 +- .../tools/Sign.proj | 2 - .../tools/Tools.proj | 1 - .../tools/Version.targets | 2 +- ...sualStudio.AcquireOptimizationData.targets | 4 +- ...isualStudio.BuildIbcTrainingInputs.targets | 6 +- .../tools/VisualStudio.VsixBuild.targets | 2 +- .../tools/VisualStudio.props | 2 +- ...osoft.DotNet.ArcadeAzureIntegration.csproj | 2 +- .../Microsoft.DotNet.ArcadeLogging.csproj | 1 + .../Microsoft.DotNet.Baselines.Tasks.csproj | 2 +- .../Microsoft.DotNet.Build.Manifest.csproj | 4 +- .../Microsoft.DotNet.Build.Tasks.Feed.csproj | 15 +- .../Microsoft.DotNet.Build.Tasks.Feed.targets | 15 +- .../src/PublishArtifactsInManifest.cs | 8 -- .../src/common/NativeMethods.cs | 12 -- ...osoft.DotNet.Build.Tasks.Installers.csproj | 8 +- ...rosoft.DotNet.Build.Tasks.Installers.props | 3 +- .../acquisition/acquire-wix/acquire-wix.proj | 2 +- .../build/bundle.targets | 2 +- .../build/installer.props | 24 ++-- .../build/wix5/wix.targets | 2 +- .../src/ArReader.cs | 16 --- .../src/ArWriter.cs | 9 -- .../src/CreateMD5SumsFile.cs | 4 - .../src/CreateRpmPackage.cs | 2 - .../src/HexConverter.cs | 27 +--- .../src/RpmBuilder.cs | 4 - .../src/StreamHelpers.cs | 21 --- ...rosoft.DotNet.Build.Tasks.Packaging.csproj | 8 +- .../src/build/Packaging.common.targets | 57 ++++---- ....DotNet.Build.Tasks.Packaging.Tests.csproj | 2 +- .../src/ChooseBestP2PTargetFrameworkTask.cs | 6 - ....DotNet.Build.Tasks.TargetFramework.csproj | 7 +- .../src/build/BinPlace.targets | 2 +- ...t.DotNet.Build.Tasks.TargetFramework.props | 3 +- ...DotNet.Build.Tasks.TargetFramework.targets | 2 +- ...DotNet.Build.Tasks.TargetFramework.targets | 2 +- ...osoft.DotNet.Build.Tasks.Templating.csproj | 2 +- ...rosoft.DotNet.Build.Tasks.Templating.props | 5 +- ...DotNet.Build.Tasks.Templating.Tests.csproj | 2 +- ...tNet.Build.Tasks.VisualStudio.Tests.csproj | 2 +- ...oft.DotNet.Build.Tasks.VisualStudio.csproj | 5 +- ....DotNet.Build.Tasks.Workloads.Tests.csproj | 10 +- ...rosoft.DotNet.Build.Tasks.Workloads.csproj | 7 +- ...crosoft.DotNet.Build.Tasks.Workloads.props | 7 +- ...osoft.DotNet.Deployment.Tasks.Links.csproj | 6 +- ...rosoft.DotNet.Deployment.Tasks.Links.props | 8 +- .../src/AkaMSLinksBase.cs | 4 - .../Microsoft.DotNet.GenAPI.csproj | 2 +- .../build/Microsoft.DotNet.GenAPI.targets | 5 +- .../Microsoft.DotNet.GenFacades.csproj | 7 +- .../RoslynBuildTask.cs | 19 --- ...oft.DotNet.GenFacades.ClearVersion.targets | 2 +- ...oft.DotNet.GenFacades.NotSupported.targets | 2 +- ...Net.GenFacades.PartialFacadeSource.targets | 2 +- .../build/Microsoft.DotNet.GenFacades.targets | 3 +- .../src/Clients/AzureDevOpsClient.cs | 86 ------------ .../src/Clients/GitHubClient.cs | 112 --------------- .../src/Helpers/CollectionExtensions.cs | 19 --- .../src/Helpers/RepositoryHelper.cs | 104 -------------- .../src/IssueManager.cs | 91 ------------ .../Microsoft.DotNet.Git.IssueManager.csproj | 19 --- .../src/Models/AzureDevOpsCommit.cs | 27 ---- .../Microsoft.DotNet.Helix.Client.csproj | 3 - .../Client/CSharp/generated-code/HelixApi.cs | 8 -- .../Microsoft.DotNet.Helix.JobSender.csproj | 3 - .../Sdk/AzureDevOpsTask.cs | 8 -- .../Sdk/BaseTask.Desktop.cs | 15 -- .../Sdk/FindDotNetCliPackage.cs | 5 +- .../Sdk/Microsoft.DotNet.Helix.Sdk.csproj | 16 +-- .../tools/Microsoft.DotNet.Helix.Sdk.props | 36 +++-- .../Cli/Microsoft.DotNet.MacOsPkg.Cli.csproj | 15 +- .../Microsoft.DotNet.NuGetRepack.Tasks.csproj | 10 +- .../tasks/src/AssemblyResolution.cs | 57 -------- .../tasks/src/ReplacePackageParts.cs | 13 -- .../tasks/src/UpdatePackageVersionTask.cs | 13 -- ...crosoft.DotNet.PackageTesting.Tests.csproj | 6 +- .../Microsoft.DotNet.PackageTesting.csproj | 6 +- .../Microsoft.DotNet.PackageTesting.props | 9 +- ...icrosoft.DotNet.SharedFramework.Sdk.csproj | 9 +- .../sdk/BuildTask.props | 14 +- .../targets/sharedfx.targets | 7 - .../Microsoft.DotNet.SignTool.Tests.csproj | 22 +-- .../SignToolTests.cs | 13 +- .../Microsoft.DotNet.SignTool.csproj | 11 +- .../build/Microsoft.DotNet.SignTool.props | 5 +- .../src/BatchSignUtil.cs | 2 +- .../src/Configuration.cs | 6 +- src/Microsoft.DotNet.SignTool/src/SignTool.cs | 8 -- .../src/SignToolArgs.cs | 4 +- .../src/SignToolTask.cs | 25 +--- .../src/VerifySignatures.cs | 42 ------ src/Microsoft.DotNet.SignTool/src/ZipData.cs | 131 +----------------- .../Microsoft.DotNet.SourceBuild.Tasks.csproj | 2 +- .../Microsoft.DotNet.SourceBuild.Tasks.props | 9 +- .../Microsoft.DotNet.StrongName.csproj | 10 -- src/Microsoft.DotNet.StrongName/Signing.cs | 2 +- ...tNet.SwaggerGenerator.CodeGenerator.csproj | 13 +- ...oft.DotNet.SwaggerGenerator.MSBuild.csproj | 6 +- ...soft.DotNet.SwaggerGenerator.MSBuild.props | 4 +- ...ft.DotNet.SwaggerGenerator.MSBuild.targets | 2 +- .../Microsoft.DotNet.Tar.csproj | 18 --- src/Microsoft.DotNet.Tar/Program.cs | 53 ------- .../Microsoft.DotNet.XliffTasks.csproj | 3 +- .../build/Microsoft.DotNet.XliffTasks.targets | 18 ++- src/SignCheck/Microsoft.SignCheck/Utils.cs | 7 +- .../Verification/AuthentiCode.cs | 98 ------------- .../Verification/AuthentiCodeVerifier.cs | 7 +- .../Verification/ExeVerifier.cs | 8 -- .../Verification/LZMAUtils.cs | 16 --- .../SignatureVerificationManager.cs | 6 +- .../Microsoft.DotNet.SignCheckTask.csproj | 7 +- .../Microsoft.DotNet.SignCheckTask.props | 5 +- .../SignCheckTask/src/SignCheckTask.cs | 18 --- tests/UnitTests.proj | 7 +- tests/XHarness.Tests.Common.props | 3 +- 145 files changed, 213 insertions(+), 1878 deletions(-) delete mode 100644 eng/BuildTask.Packages.props delete mode 100644 src/Common/Internal/AssemblyResolution.cs delete mode 100644 src/Common/Internal/AssemblyResolver.cs delete mode 100644 src/Common/Internal/BuildTask.Desktop.cs delete mode 100644 src/Common/Microsoft.Arcade.Common/MSBuildTaskBase.Desktop.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Clients/AzureDevOpsClient.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Clients/GitHubClient.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Helpers/CollectionExtensions.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Helpers/RepositoryHelper.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/IssueManager.cs delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Microsoft.DotNet.Git.IssueManager.csproj delete mode 100644 src/Microsoft.DotNet.Git.IssueManager/src/Models/AzureDevOpsCommit.cs delete mode 100644 src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs delete mode 100644 src/Microsoft.DotNet.NuGetRepack/tasks/src/AssemblyResolution.cs delete mode 100644 src/Microsoft.DotNet.Tar/Microsoft.DotNet.Tar.csproj delete mode 100644 src/Microsoft.DotNet.Tar/Program.cs diff --git a/Arcade.slnx b/Arcade.slnx index 337ee9c2279..b6f4c7cb532 100644 --- a/Arcade.slnx +++ b/Arcade.slnx @@ -60,7 +60,6 @@ - @@ -72,7 +71,6 @@ - diff --git a/eng/BuildTask.Packages.props b/eng/BuildTask.Packages.props deleted file mode 100644 index d8f9f790066..00000000000 --- a/eng/BuildTask.Packages.props +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/eng/BuildTask.targets b/eng/BuildTask.targets index 68346ee899f..6a3787512a9 100644 --- a/eng/BuildTask.targets +++ b/eng/BuildTask.targets @@ -1,7 +1,5 @@ - - false true @@ -11,7 +9,7 @@ true tools true - $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore;_AddBuildOutputToPackageDesktop + $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore - + @@ -55,24 +53,6 @@ - - - - - - - - - - - - - - - - - - - @@ -102,14 +75,4 @@ - - - - netframework - - - - - - diff --git a/eng/Microsoft.DotNet.SwaggerGenerator.MSBuild.InTree.targets b/eng/Microsoft.DotNet.SwaggerGenerator.MSBuild.InTree.targets index 7772d6a8c88..516f70d06ec 100644 --- a/eng/Microsoft.DotNet.SwaggerGenerator.MSBuild.InTree.targets +++ b/eng/Microsoft.DotNet.SwaggerGenerator.MSBuild.InTree.targets @@ -4,10 +4,7 @@ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'Microsoft.DotNet.SwaggerGenerator', 'Microsoft.DotNet.SwaggerGenerator.MSBuild')) $(ArtifactsBinDir)Microsoft.DotNet.SwaggerGenerator.MSBuild\$(Configuration)\ - $(MicrosoftDotNetSwaggerGeneratorMSBuildBaseOutputDirectory)$(NetToolCurrent)\ - $(MicrosoftDotNetSwaggerGeneratorMSBuildBaseOutputDirectory)$(NetFrameworkToolCurrent)\ - - TaskHostFactory + $(MicrosoftDotNetSwaggerGeneratorMSBuildBaseOutputDirectory)$(NetToolCurrent)\ ResolveProjectReferences @@ -25,9 +22,8 @@ ReferenceOutputAssembly="false" PrivateAssets="all" Private="false"> - - TargetFramework=$(NetToolCurrent) - TargetFramework=$(NetFrameworkToolCurrent) + + TargetFramework=$(NetToolCurrent) diff --git a/src/Common/Internal/AssemblyResolution.cs b/src/Common/Internal/AssemblyResolution.cs deleted file mode 100644 index caea03260c1..00000000000 --- a/src/Common/Internal/AssemblyResolution.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#if NET472 - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.DotNet -{ - internal static class AssemblyResolution - { - internal static TaskLoggingHelper Log; - - public static void Initialize() - { - AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve; - } - - private static Assembly AssemblyResolve(object sender, ResolveEventArgs args) - { - var name = new AssemblyName(args.Name); - - if (!name.Name.Equals("System.Collections.Immutable", StringComparison.OrdinalIgnoreCase)) - { - return null; - } - - var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "System.Collections.Immutable.dll"); - - Assembly sci; - try - { - sci = Assembly.LoadFile(fullPath); - } - catch (Exception e) - { - Log?.LogWarning($"AssemblyResolve: exception while loading '{fullPath}': {e.Message}"); - return null; - } - - if (name.Version <= sci.GetName().Version) - { - Log?.LogMessage(MessageImportance.Low, $"AssemblyResolve: loaded '{fullPath}' to {AppDomain.CurrentDomain.FriendlyName}"); - return sci; - } - - return null; - } - } -} - -#endif diff --git a/src/Common/Internal/AssemblyResolver.cs b/src/Common/Internal/AssemblyResolver.cs deleted file mode 100644 index d398408cc29..00000000000 --- a/src/Common/Internal/AssemblyResolver.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Diagnostics; -using System.IO; -using System.Reflection; - -namespace Microsoft.Arcade.Common.Desktop -{ - /// - /// Used to enable app-local assembly unification. - /// - internal static class AssemblyResolver - { - static AssemblyResolver() - { - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - } - - /// - /// Call to enable the assembly resolver for the current AppDomain. - /// - public static void Enable() - { - // intentionally empty. This is just meant to ensure the static constructor - // has run. - } - - private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - // apply any existing policy - AssemblyName referenceName = new AssemblyName(AppDomain.CurrentDomain.ApplyPolicy(args.Name)); - - string fileName = referenceName.Name + ".dll"; - string assemblyPath = null; - string probingPath = null; - Assembly assm = null; - - // look next to requesting assembly - assemblyPath = args.RequestingAssembly?.Location; - if (!String.IsNullOrEmpty(assemblyPath)) - { - probingPath = Path.Combine(Path.GetDirectoryName(assemblyPath), fileName); - Debug.WriteLine($"Considering {probingPath} based on RequestingAssembly"); - if (Probe(probingPath, referenceName.Version, out assm)) - { - return assm; - } - } - - // look next to the executing assembly - assemblyPath = Assembly.GetExecutingAssembly().Location; - if (!String.IsNullOrEmpty(assemblyPath)) - { - probingPath = Path.Combine(Path.GetDirectoryName(assemblyPath), fileName); - - Debug.WriteLine($"Considering {probingPath} based on ExecutingAssembly"); - if (Probe(probingPath, referenceName.Version, out assm)) - { - return assm; - } - } - - // look in AppDomain base directory - probingPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); - Debug.WriteLine($"Considering {probingPath} based on BaseDirectory"); - if (Probe(probingPath, referenceName.Version, out assm)) - { - return assm; - } - - // look in current directory - Debug.WriteLine($"Considering {fileName}"); - if (Probe(fileName, referenceName.Version, out assm)) - { - return assm; - } - - return null; - } - - /// - /// Considers a path to load for satisfying an assembly ref and loads it - /// if the file exists and version is sufficient. - /// - /// Path to consider for load - /// Minimum version to consider - /// loaded assembly - /// true if assembly was loaded - private static bool Probe(string filePath, Version minimumVersion, out Assembly assembly) - { - if (File.Exists(filePath)) - { - AssemblyName name = AssemblyName.GetAssemblyName(filePath); - - if (name.Version >= minimumVersion) - { - assembly = Assembly.Load(name); - return true; - } - } - - assembly = null; - return false; - } - } -} diff --git a/src/Common/Internal/BuildTask.Desktop.cs b/src/Common/Internal/BuildTask.Desktop.cs deleted file mode 100644 index f71609229a9..00000000000 --- a/src/Common/Internal/BuildTask.Desktop.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.Arcade.Common.Desktop -{ - public partial class BuildTask - { - static BuildTask() - { - AssemblyResolver.Enable(); - } - } -} diff --git a/src/Common/Microsoft.Arcade.Common/MSBuildTaskBase.Desktop.cs b/src/Common/Microsoft.Arcade.Common/MSBuildTaskBase.Desktop.cs deleted file mode 100644 index 39d999e8f92..00000000000 --- a/src/Common/Microsoft.Arcade.Common/MSBuildTaskBase.Desktop.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.Arcade.Common.Desktop; - -namespace Microsoft.Arcade.Common -{ - public partial class MSBuildTaskBase - { - static MSBuildTaskBase() - { - AssemblyResolver.Enable(); - } - } -} diff --git a/src/Common/Microsoft.Arcade.Common/Microsoft.Arcade.Common.csproj b/src/Common/Microsoft.Arcade.Common/Microsoft.Arcade.Common.csproj index bf6d4c11032..e858f781c96 100644 --- a/src/Common/Microsoft.Arcade.Common/Microsoft.Arcade.Common.csproj +++ b/src/Common/Microsoft.Arcade.Common/Microsoft.Arcade.Common.csproj @@ -2,9 +2,8 @@ - $(NetToolCurrent);netstandard2.0;$(NetFrameworkToolCurrent) + $(NetToolCurrent) true - **/*.Desktop.* @@ -13,14 +12,4 @@ - - - - - - - - - - diff --git a/src/Common/Microsoft.Arcade.Test.Common/Microsoft.Arcade.Test.Common.csproj b/src/Common/Microsoft.Arcade.Test.Common/Microsoft.Arcade.Test.Common.csproj index 4867a58638f..d2a1d0f193d 100644 --- a/src/Common/Microsoft.Arcade.Test.Common/Microsoft.Arcade.Test.Common.csproj +++ b/src/Common/Microsoft.Arcade.Test.Common/Microsoft.Arcade.Test.Common.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true @@ -10,10 +10,6 @@ - - - - diff --git a/src/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj b/src/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj index 4a6d36711e0..ff6c7b57192 100644 --- a/src/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj +++ b/src/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj @@ -1,8 +1,7 @@ - - $(NetToolCurrent);netstandard2.0;$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true true @@ -20,16 +19,4 @@ - - - - - - - - - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj index baebf769c53..aec1ef97d46 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj +++ b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true @@ -26,11 +26,6 @@ - - - - - @@ -47,10 +42,6 @@ PackagePath="tools\DefaultVersions.Generated.props" /> - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs b/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs index 9fe6fb49651..d76eb4aa53a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs +++ b/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs @@ -128,7 +128,6 @@ private async Tasks.Task DownloadFromUriAsync(string uri) { // on Mac if the endpoint is not available. This is only available on .NET Core, but has only been // observed on Mac anyway. -#if NET using SocketsHttpHandler handler = new SocketsHttpHandler(); handler.SslOptions.CertificateChainPolicy = new X509ChainPolicy { @@ -151,9 +150,6 @@ private async Tasks.Task DownloadFromUriAsync(string uri) { }; using (var httpClient = new HttpClient(handler)) -#else - using (var httpClient = new HttpClient(new HttpClientHandler { CheckCertificateRevocationList = true })) -#endif { httpClient.Timeout = TimeSpan.FromSeconds(TimeoutInSeconds); try diff --git a/src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs b/src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs index d195c79398e..a0abef70c0f 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs +++ b/src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs @@ -37,15 +37,6 @@ private void ExecuteImpl() { const string fileName = "license"; -#if NET472 - IEnumerable enumerateFiles(string extension) - { - var fileNameWithExtension = fileName + extension; - return System.IO.Directory.EnumerateFiles(Directory, "*", SearchOption.TopDirectoryOnly) - .Where(path => string.Equals(fileNameWithExtension, System.IO.Path.GetFileName(path), System.StringComparison.OrdinalIgnoreCase)); - } - -#else var options = new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive, @@ -57,7 +48,7 @@ IEnumerable enumerateFiles(string extension) IEnumerable enumerateFiles(string extension) => System.IO.Directory.EnumerateFileSystemEntries(Directory, fileName + extension, options); -#endif + var matches = (from extension in new[] { ".txt", ".md", "" } from path in enumerateFiles(extension) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs b/src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs index d3ff77edbb5..28a937ef85b 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs +++ b/src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs @@ -16,15 +16,8 @@ namespace Microsoft.DotNet.Arcade.Sdk { -#if NET472 - [LoadInSeparateAppDomain] - public class InstallDotNetCore : AppDomainIsolatedTask - { - static InstallDotNetCore() => AssemblyResolution.Initialize(); -#else public class InstallDotNetCore : Microsoft.Build.Utilities.Task { -#endif private static readonly char[] s_keyTrimChars = [ '$', '(', ')' ]; public string VersionsPropsPath { get; set; } diff --git a/src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs b/src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs index 593ba369bc9..98525024117 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs +++ b/src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs @@ -12,15 +12,8 @@ namespace Microsoft.DotNet.Arcade.Sdk { -#if NET472 - [LoadInSeparateAppDomain] - public class SetCorFlags : AppDomainIsolatedTask - { - static SetCorFlags() => AssemblyResolution.Initialize(); -#else public class SetCorFlags : Microsoft.Build.Utilities.Task { -#endif [Required] public string FilePath { get; set; } @@ -35,9 +28,6 @@ public class SetCorFlags : Microsoft.Build.Utilities.Task public override bool Execute() { -#if NET472 - AssemblyResolution.Log = Log; -#endif try { ExecuteImpl(); @@ -45,9 +35,6 @@ public override bool Execute() } finally { -#if NET472 - AssemblyResolution.Log = null; -#endif } } diff --git a/src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs b/src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs index 934939e265d..f9c8bf00b2b 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs +++ b/src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs @@ -12,23 +12,13 @@ namespace Microsoft.DotNet.Arcade.Sdk { -#if NET472 - [LoadInSeparateAppDomain] - public sealed class Unsign : AppDomainIsolatedTask - { - static Unsign() => AssemblyResolution.Initialize(); -#else public class Unsign : Microsoft.Build.Utilities.Task { -#endif [Required] public string FilePath { get; set; } public override bool Execute() { -#if NET472 - AssemblyResolution.Log = Log; -#endif try { ExecuteImpl(); @@ -36,9 +26,6 @@ public override bool Execute() } finally { -#if NET472 - AssemblyResolution.Log = null; -#endif } } diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets index 3feeaf2ea1d..048dcff3db1 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets @@ -2,11 +2,10 @@ - <_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\netframework\Microsoft.DotNet.NuGetRepack.Tasks.dll - <_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net\Microsoft.DotNet.NuGetRepack.Tasks.dll + <_NuGetRepackAssembly>$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net\Microsoft.DotNet.NuGetRepack.Tasks.dll - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props index b2dcf8a2d5b..42ef5318eeb 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props @@ -2,8 +2,7 @@ - $(MSBuildThisFileDirectory)netframework\Microsoft.DotNet.Arcade.Sdk.dll - $(MSBuildThisFileDirectory)net\Microsoft.DotNet.Arcade.Sdk.dll + $(MSBuildThisFileDirectory)net\Microsoft.DotNet.Arcade.Sdk.dll diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets index b272e667b44..b625b3e70e9 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets @@ -1,7 +1,7 @@ - + - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets index c59c07cb980..71f9c832e6b 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets @@ -1,7 +1,7 @@ - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets index 17dc8a55daa..24ef2781aa1 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets @@ -13,9 +13,9 @@ OptimizeAssembly Set of assemblies to apply Partial NGEN optimization data to. --> - - - + + + $(IntermediateOutputPath)$(TargetFileName).pcbm diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj index f56db0fa71d..44834f60188 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj @@ -34,7 +34,7 @@ - + - + $(BeforePack);_AddSourcePackageSourceLinkFile diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj index ba32af54e3f..5efc4b438dd 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj @@ -8,8 +8,8 @@ - - + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj index 2687f94083a..3c844027ae3 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj @@ -2,7 +2,7 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) Publish diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj index 6fbe0aa5c73..c21d5087800 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj @@ -19,7 +19,7 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) Publish diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.BuildIbcTrainingSettings.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.BuildIbcTrainingSettings.proj index 3b423874bdb..cec7c2c0a5c 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.BuildIbcTrainingSettings.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.BuildIbcTrainingSettings.proj @@ -20,10 +20,10 @@ - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\netframework\Microsoft.DotNet.Build.Tasks.VisualStudio.dll + <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - + <_OutputFilePath>$(VisualStudioSetupInsertionPath)OptProf\Training.runsettings diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj index cf2a163077a..d2d1d0dcdd9 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj @@ -72,7 +72,6 @@ <_DotNetCorePath>$(DotNetTool) - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets index 7dbd2411e9c..fab5620c279 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets @@ -8,7 +8,7 @@ SemanticVersioningV1 "true" if the Version needs to respect SemVer 1.0. Default is false, which means format following SemVer 2.0. --> - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets index 9979a784c8c..33704816096 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets @@ -11,10 +11,10 @@ --> - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\netframework\Microsoft.DotNet.Build.Tasks.VisualStudio.dll + <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - + true diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets index d9d6a384058..39949cff687 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets @@ -8,11 +8,11 @@ --> - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\netframework\Microsoft.DotNet.Build.Tasks.VisualStudio.dll + <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - - + + - + diff --git a/src/Microsoft.DotNet.ArcadeAzureIntegration/Microsoft.DotNet.ArcadeAzureIntegration.csproj b/src/Microsoft.DotNet.ArcadeAzureIntegration/Microsoft.DotNet.ArcadeAzureIntegration.csproj index 514a08a6c5a..65377300dc0 100644 --- a/src/Microsoft.DotNet.ArcadeAzureIntegration/Microsoft.DotNet.ArcadeAzureIntegration.csproj +++ b/src/Microsoft.DotNet.ArcadeAzureIntegration/Microsoft.DotNet.ArcadeAzureIntegration.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) diff --git a/src/Microsoft.DotNet.ArcadeLogging/Microsoft.DotNet.ArcadeLogging.csproj b/src/Microsoft.DotNet.ArcadeLogging/Microsoft.DotNet.ArcadeLogging.csproj index 66710e1db8f..a233184d416 100644 --- a/src/Microsoft.DotNet.ArcadeLogging/Microsoft.DotNet.ArcadeLogging.csproj +++ b/src/Microsoft.DotNet.ArcadeLogging/Microsoft.DotNet.ArcadeLogging.csproj @@ -1,6 +1,7 @@ + $(NetToolCurrent);$(NetFrameworkToolCurrent) diff --git a/src/Microsoft.DotNet.Baselines.Tasks/Microsoft.DotNet.Baselines.Tasks.csproj b/src/Microsoft.DotNet.Baselines.Tasks/Microsoft.DotNet.Baselines.Tasks.csproj index 424d6c6c739..f1d5ae35422 100644 --- a/src/Microsoft.DotNet.Baselines.Tasks/Microsoft.DotNet.Baselines.Tasks.csproj +++ b/src/Microsoft.DotNet.Baselines.Tasks/Microsoft.DotNet.Baselines.Tasks.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent) + $(NetToolCurrent) true true true diff --git a/src/Microsoft.DotNet.Build.Manifest/Microsoft.DotNet.Build.Manifest.csproj b/src/Microsoft.DotNet.Build.Manifest/Microsoft.DotNet.Build.Manifest.csproj index 9bdb9f1d51f..22b43ca6017 100644 --- a/src/Microsoft.DotNet.Build.Manifest/Microsoft.DotNet.Build.Manifest.csproj +++ b/src/Microsoft.DotNet.Build.Manifest/Microsoft.DotNet.Build.Manifest.csproj @@ -1,7 +1,7 @@  - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true @@ -17,6 +17,4 @@ - - diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/Microsoft.DotNet.Build.Tasks.Feed.csproj b/src/Microsoft.DotNet.Build.Tasks.Feed/Microsoft.DotNet.Build.Tasks.Feed.csproj index f3cb15a12eb..3ee56588559 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/Microsoft.DotNet.Build.Tasks.Feed.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/Microsoft.DotNet.Build.Tasks.Feed.csproj @@ -1,7 +1,7 @@  - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true false This package provides support for publishing assets to appropriate channels. @@ -23,7 +23,7 @@ - + @@ -34,13 +34,6 @@ the symbol publishing doesn't run on framework anyway (this project has a throwing stub for .NET framework in that path due to the reliance in maestro). Until we really need to multitarget, this is the better path. --> - - - - - - @@ -55,8 +48,8 @@ - - + + diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/build/Microsoft.DotNet.Build.Tasks.Feed.targets b/src/Microsoft.DotNet.Build.Tasks.Feed/build/Microsoft.DotNet.Build.Tasks.Feed.targets index 9b7f8eb8a71..05579d54b39 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/build/Microsoft.DotNet.Build.Tasks.Feed.targets +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/build/Microsoft.DotNet.Build.Tasks.Feed.targets @@ -43,15 +43,14 @@ --> - <_MicrosoftDotNetBuildTasksFeedTaskDir>$(MSBuildThisFileDirectory)../tools/netframework/ - <_MicrosoftDotNetBuildTasksFeedTaskDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)../tools/net/ + <_MicrosoftDotNetBuildTasksFeedTaskDir>$(MSBuildThisFileDirectory)../tools/net/ - - - - - - + + + + + + diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs index 480d5985395..b3429746a2e 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs @@ -389,11 +389,7 @@ internal PublishArtifactsInManifestBase ConstructPublishingV3Task(BuildModel bui SkipSafetyChecks = this.SkipSafetyChecks, AkaMSClientId = this.AkaMSClientId, AkaMSClientCertificate = !string.IsNullOrEmpty(AkaMSClientCertificate) ? -#if NET9_0_OR_GREATER X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate)), password: null) : null, -#else - new X509Certificate2(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate))) : null, -#endif AkaMSCreatedBy = this.AkaMSCreatedBy, AkaMSGroupOwner = this.AkaMSGroupOwner, AkaMsOwners = this.AkaMsOwners, @@ -439,11 +435,7 @@ internal PublishArtifactsInManifestBase ConstructPublishingV4Task(BuildModel bui SkipSafetyChecks = this.SkipSafetyChecks, AkaMSClientId = this.AkaMSClientId, AkaMSClientCertificate = !string.IsNullOrEmpty(AkaMSClientCertificate) ? -#if NET9_0_OR_GREATER X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate)), password: null) : null, -#else - new X509Certificate2(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate))) : null, -#endif AkaMSCreatedBy = this.AkaMSCreatedBy, AkaMSGroupOwner = this.AkaMSGroupOwner, AkaMsOwners = this.AkaMsOwners, diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/common/NativeMethods.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/common/NativeMethods.cs index 7eaa76db72a..daaa643f1b5 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/common/NativeMethods.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/common/NativeMethods.cs @@ -3,30 +3,18 @@ using System; using System.Runtime.InteropServices; -#if NET using System.Runtime.InteropServices.Marshalling; -#endif namespace Microsoft.DotNet.Build.Tasks.Feed { internal partial class NativeMethods { -#if NET [LibraryImport("kernel32.dll", EntryPoint = "CreateHardLinkW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool CreateHardLink(string newFileName, string exitingFileName, IntPtr securityAttributes); -#else - [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern bool CreateHardLink(string newFileName, string exitingFileName, IntPtr securityAttributes); -#endif -#if NET [LibraryImport("libc", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] internal static partial int link(string oldpath, string newpath); -#else - [DllImport("libc", SetLastError = true)] - internal static extern int link(string oldpath, string newpath); -#endif internal static bool MakeHardLink(string newFileName, string exitingFileName, ref string errorMessage) { diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj b/src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj index b802bc9a24a..2b79f72cdf6 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true true @@ -39,12 +39,6 @@ Pack="true" /> - - - - - - diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/build/Microsoft.DotNet.Build.Tasks.Installers.props b/src/Microsoft.DotNet.Build.Tasks.Installers/build/Microsoft.DotNet.Build.Tasks.Installers.props index f5996ed1b57..29db77597b8 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Installers/build/Microsoft.DotNet.Build.Tasks.Installers.props +++ b/src/Microsoft.DotNet.Build.Tasks.Installers/build/Microsoft.DotNet.Build.Tasks.Installers.props @@ -2,8 +2,7 @@ - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Installers.dll - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.Build.Tasks.Installers.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Installers.dll $(MSBuildThisFileDirectory) diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj b/src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj index 5b3076d67cf..fa456d1efc3 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj +++ b/src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj @@ -1,7 +1,7 @@ - + - + - - - - - - + + + + + + + + AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" Runtime="NET" /> + AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" Runtime="NET" /> + AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" Runtime="NET" /> + AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" Runtime="NET" /> + AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" Runtime="NET" /> diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/build/wix5/wix.targets b/src/Microsoft.DotNet.Build.Tasks.Installers/build/wix5/wix.targets index 131b6db1556..b1068fc86d1 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Installers/build/wix5/wix.targets +++ b/src/Microsoft.DotNet.Build.Tasks.Installers/build/wix5/wix.targets @@ -1,7 +1,7 @@ - + - + true diff --git a/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.props b/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.props index d0180c04142..b548e38c216 100644 --- a/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.props +++ b/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.props @@ -2,8 +2,7 @@ - ..\tools\net\Microsoft.DotNet.Build.Tasks.TargetFramework.dll - ..\tools\netframework\Microsoft.DotNet.Build.Tasks.TargetFramework.dll + ..\tools\net\Microsoft.DotNet.Build.Tasks.TargetFramework.dll diff --git a/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.targets b/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.targets index ccf6b879ff0..19f7f200885 100644 --- a/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.targets +++ b/src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.targets @@ -1,7 +1,7 @@ - + - + - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) Templating task package true true diff --git a/src/Microsoft.DotNet.Build.Tasks.Templating/src/build/Microsoft.DotNet.Build.Tasks.Templating.props b/src/Microsoft.DotNet.Build.Tasks.Templating/src/build/Microsoft.DotNet.Build.Tasks.Templating.props index 358cf132b71..c2835e13031 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Templating/src/build/Microsoft.DotNet.Build.Tasks.Templating.props +++ b/src/Microsoft.DotNet.Build.Tasks.Templating/src/build/Microsoft.DotNet.Build.Tasks.Templating.props @@ -2,10 +2,9 @@ - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Templating.dll - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.Build.Tasks.Templating.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Templating.dll - + diff --git a/src/Microsoft.DotNet.Build.Tasks.Templating/test/Microsoft.DotNet.Build.Tasks.Templating.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.Templating/test/Microsoft.DotNet.Build.Tasks.Templating.Tests.csproj index 03679598d86..d182a39c781 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Templating/test/Microsoft.DotNet.Build.Tasks.Templating.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Templating/test/Microsoft.DotNet.Build.Tasks.Templating.Tests.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj index e276d85658e..a4898226b76 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj @@ -1,7 +1,7 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj index 410c5cee1c6..1a2a0cd1019 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj @@ -1,7 +1,7 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) true true Arcade SDK build tasks for Visual Studio profile guided optimization training @@ -12,9 +12,6 @@ - - - diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj index cd322aac72d..7a9270117cb 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj @@ -1,7 +1,7 @@  - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) @@ -14,10 +14,6 @@ - - - - @@ -36,10 +32,6 @@ - - - - diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj index 0f1d87796bc..32099ff887d 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true true @@ -30,11 +30,6 @@ - - - - - diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/build/Microsoft.DotNet.Build.Tasks.Workloads.props b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/build/Microsoft.DotNet.Build.Tasks.Workloads.props index 6c44c02a663..3636efb67aa 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/build/Microsoft.DotNet.Build.Tasks.Workloads.props +++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/build/Microsoft.DotNet.Build.Tasks.Workloads.props @@ -2,11 +2,10 @@ - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Workloads.dll - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.Build.Tasks.Workloads.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.Workloads.dll - - + + diff --git a/src/Microsoft.DotNet.Deployment.Tasks.Links/Microsoft.DotNet.Deployment.Tasks.Links.csproj b/src/Microsoft.DotNet.Deployment.Tasks.Links/Microsoft.DotNet.Deployment.Tasks.Links.csproj index 18ba7e8e323..2afa88eb4c1 100644 --- a/src/Microsoft.DotNet.Deployment.Tasks.Links/Microsoft.DotNet.Deployment.Tasks.Links.csproj +++ b/src/Microsoft.DotNet.Deployment.Tasks.Links/Microsoft.DotNet.Deployment.Tasks.Links.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true Aka.ms link manager @@ -20,8 +20,4 @@ - - - - diff --git a/src/Microsoft.DotNet.Deployment.Tasks.Links/build/Microsoft.DotNet.Deployment.Tasks.Links.props b/src/Microsoft.DotNet.Deployment.Tasks.Links/build/Microsoft.DotNet.Deployment.Tasks.Links.props index 50e5224cdb5..5a0d42049fa 100644 --- a/src/Microsoft.DotNet.Deployment.Tasks.Links/build/Microsoft.DotNet.Deployment.Tasks.Links.props +++ b/src/Microsoft.DotNet.Deployment.Tasks.Links/build/Microsoft.DotNet.Deployment.Tasks.Links.props @@ -2,11 +2,9 @@ - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Deployment.Tasks.Links.dll - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.Deployment.Tasks.Links.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Deployment.Tasks.Links.dll - - - + + diff --git a/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs b/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs index 77a64125333..704a968428d 100644 --- a/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs +++ b/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs @@ -24,11 +24,7 @@ protected AkaMSLinkManager CreateAkaMSLinksManager() AkaMSLinkManager manager; if (!string.IsNullOrEmpty(ClientCertificate)) { -#if NET9_0_OR_GREATER manager = new AkaMSLinkManager(ClientId, X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(ClientCertificate)), password: null), Tenant, Log); -#else - manager = new AkaMSLinkManager(ClientId, new X509Certificate2(Convert.FromBase64String(File.ReadAllText(ClientCertificate))), Tenant, Log); -#endif } else if (!string.IsNullOrEmpty(ClientSecret)) { diff --git a/src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj b/src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj index 841055a6823..dce46d9ce7d 100644 --- a/src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj +++ b/src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true MSBuildSdk true diff --git a/src/Microsoft.DotNet.GenAPI/build/Microsoft.DotNet.GenAPI.targets b/src/Microsoft.DotNet.GenAPI/build/Microsoft.DotNet.GenAPI.targets index 38560453f49..dd8968a723a 100644 --- a/src/Microsoft.DotNet.GenAPI/build/Microsoft.DotNet.GenAPI.targets +++ b/src/Microsoft.DotNet.GenAPI/build/Microsoft.DotNet.GenAPI.targets @@ -2,8 +2,7 @@ - $(MSBuildThisFileDirectory)\..\tools\net\Microsoft.DotNet.GenAPI.dll - $(MSBuildThisFileDirectory)\..\tools\netframework\Microsoft.DotNet.GenAPI.dll + $(MSBuildThisFileDirectory)\..\tools\net\Microsoft.DotNet.GenAPI.dll @@ -25,7 +24,7 @@ - + diff --git a/src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj b/src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj index 119fce5fc77..e79dd945d0b 100644 --- a/src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj +++ b/src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) MSBuildSdk true true @@ -16,9 +16,4 @@ - - - - - diff --git a/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs b/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs index 42b61be4397..fa5389b6b82 100644 --- a/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs +++ b/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs @@ -6,9 +6,6 @@ using System; using System.IO; using System.Reflection; -#if NETCOREAPP -using System.Runtime.Loader; -#endif namespace Microsoft.DotNet.Build.Tasks { @@ -19,40 +16,24 @@ public abstract partial class RoslynBuildTask : BuildTask public override bool Execute() { -#if NETCOREAPP AssemblyLoadContext currentContext = AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly())!; currentContext.Resolving += ResolverForRoslyn; -#else - AppDomain.CurrentDomain.AssemblyResolve += ResolverForRoslyn; -#endif try { return ExecuteCore(); } finally { -#if NETCOREAPP currentContext.Resolving -= ResolverForRoslyn; -#else - AppDomain.CurrentDomain.AssemblyResolve -= ResolverForRoslyn; -#endif } } public abstract bool ExecuteCore(); -#if NETCOREAPP private Assembly ResolverForRoslyn(AssemblyLoadContext context, AssemblyName assemblyName) { return LoadRoslyn(assemblyName, path => context.LoadFromAssemblyPath(path)); } -#else - private Assembly ResolverForRoslyn(object sender, ResolveEventArgs args) - { - AssemblyName name = new(args.Name); - return LoadRoslyn(name, path => Assembly.LoadFrom(path)); - } -#endif private Assembly LoadRoslyn(AssemblyName name, Func loadFromPath) { diff --git a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.ClearVersion.targets b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.ClearVersion.targets index 34b4f7787b4..22620a07d9f 100644 --- a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.ClearVersion.targets +++ b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.ClearVersion.targets @@ -1,7 +1,7 @@ - + diff --git a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.NotSupported.targets b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.NotSupported.targets index 86ead85a490..46a061c0f5a 100644 --- a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.NotSupported.targets +++ b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.NotSupported.targets @@ -1,7 +1,7 @@ - + AddGenFacadeNotSupportedCompileItem;$(CoreCompileDependsOn) diff --git a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.PartialFacadeSource.targets b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.PartialFacadeSource.targets index 5a1c6439a83..df655759d85 100644 --- a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.PartialFacadeSource.targets +++ b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.PartialFacadeSource.targets @@ -1,7 +1,7 @@ - + ReferencePath diff --git a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.targets b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.targets index 0d0215d40ac..20656c4312b 100644 --- a/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.targets +++ b/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacades.targets @@ -2,8 +2,7 @@ - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.GenFacades.dll - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.GenFacades.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.GenFacades.dll diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Clients/AzureDevOpsClient.cs b/src/Microsoft.DotNet.Git.IssueManager/src/Clients/AzureDevOpsClient.cs deleted file mode 100644 index 69261ed743b..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Clients/AzureDevOpsClient.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Newtonsoft.Json; -using System; -using System.Linq; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace Microsoft.DotNet.Git.IssueManager.Clients -{ - static class AzureDevOpsClient - { - private static readonly Regex RepositoryUriPattern = new Regex( - @"^https://dev\.azure\.com\/(?[a-zA-Z0-9]+)/(?[a-zA-Z0-9-]+)/_git/(?[a-zA-Z0-9-\\.]+)"); - - private static readonly Regex LegacyRepositoryUriPattern = new Regex( - @"^https://(?[a-zA-Z0-9]+)\.visualstudio\.com/(?[a-zA-Z0-9-]+)/_git/(?[a-zA-Z0-9-\.]+)"); - - private const string DefaultApiVersion = "5.0"; - - public static async Task GetCommitAuthorAsync( - string repositoryUrl, - string commit, - string personalAccessToken) - { - (string accountName, string projectName, string repoName) = ParseRepoUri(repositoryUrl); - - using (HttpClient httpClient = GetHttpClient(accountName, projectName, personalAccessToken)) - { - HttpRequestMessage getMessage = new HttpRequestMessage(HttpMethod.Get, $"_apis/git/repositories/{repoName}/commits?searchCriteria.ids={commit}"); - HttpResponseMessage response = await httpClient.SendAsync(getMessage); - - response.EnsureSuccessStatusCode(); - - AzureDevOpsCommit commitResponse = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - if (commitResponse == null) - { - throw new Exception($"No commit with id {commit} found in '{repositoryUrl}'"); - } - - return $"Azure DevOps user: {commitResponse.Value.First().Author.Name}"; - } - } - - private static HttpClient GetHttpClient(string accountName, string projectName, string personalAccessToken) - { - HttpClient client = new HttpClient(new HttpClientHandler { CheckCertificateRevocationList = true }) - { - BaseAddress = new Uri($"https://dev.azure.com/{accountName}/{projectName}/") - }; - - client.DefaultRequestHeaders.Add( - "Accept", - $"application/json;api-version={DefaultApiVersion}"); - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( - "Basic", - Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "", personalAccessToken)))); - - return client; - } - - private static (string accountName, string projectName, string repoName) ParseRepoUri(string repositoryUri) - { - Match m = RepositoryUriPattern.Match(repositoryUri); - if (!m.Success) - { - m = LegacyRepositoryUriPattern.Match(repositoryUri); - if (!m.Success) - { - throw new ArgumentException( - "Repository URI should be in the form https://dev.azure.com/:account/:project/_git/:repo or " + - "https://:account.visualstudio.com/:project/_git/:repo"); - } - } - - return (m.Groups["account"].Value, - m.Groups["project"].Value, - m.Groups["repo"].Value); - } - } -} diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Clients/GitHubClient.cs b/src/Microsoft.DotNet.Git.IssueManager/src/Clients/GitHubClient.cs deleted file mode 100644 index 438eb49763e..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Clients/GitHubClient.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Octokit; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Microsoft.DotNet.Git.IssueManager.Helpers; - -namespace Microsoft.DotNet.Git.IssueManager.Clients -{ - static class GitHubClient - { - public static async Task GetCommitAuthorAsync( - string repositoryUrl, - string commit, - string personalAccessToken) - { - (string owner, string repoName) = ParseRepoUri(repositoryUrl); - - Octokit.GitHubClient client = new Octokit.GitHubClient(new ProductHeaderValue("assets-publisher")); - Credentials tokenAuth = new Credentials(personalAccessToken); - client.Credentials = tokenAuth; - - GitHubCommit commitInfo = await client.Repository.Commit.Get(owner, repoName, commit); - - while (commitInfo.Author.Type == "Bot") - { - if (!commitInfo.Parents.Any()) break; - commit = commitInfo.Parents.First().Sha; - commitInfo = await client.Repository.Commit.Get(owner, repoName, commit); - } - - return $"@{commitInfo.Author.Login}"; - } - - public static async Task CreateNewIssueAsync( - string repositoryUrl, - string issueTitle, - string issueDescription, - string personalAccessToken, - int? milestone = null, - IEnumerable labels = null, - IEnumerable assignees = null) - { - (string owner, string repoName) = ParseRepoUri(repositoryUrl); - - Octokit.GitHubClient client = new Octokit.GitHubClient(new ProductHeaderValue("assets-publisher")); - Credentials tokenAuth = new Credentials(personalAccessToken); - client.Credentials = tokenAuth; - - NewIssue issueToBeCreated = new NewIssue(issueTitle) - { - Body = issueDescription, - Milestone = milestone - }; - - if (labels is not null) - { - issueToBeCreated.Labels.AddRange(labels); - } - - if (assignees is not null) - { - issueToBeCreated.Assignees.AddRange(assignees); - } - - Issue createdIssue = await client.Issue.Create(owner, repoName, issueToBeCreated); - - return createdIssue.Number; - } - - public static async Task CreateNewIssueCommentAsync( - string repositoryUrl, - int issueNumber, - string comment, - string personalAccessToken) - { - (string owner, string repoName) = ParseRepoUri(repositoryUrl); - - Octokit.GitHubClient client = new Octokit.GitHubClient(new ProductHeaderValue("assets-publisher")); - Credentials tokenAuth = new Credentials(personalAccessToken); - client.Credentials = tokenAuth; - - IssueComment createdComment = await client.Issue.Comment.Create(owner, repoName, issueNumber, comment); - - return createdComment.HtmlUrl; - } - - /// - /// Extracts the owner and repository name from . - /// - /// The repository URI. - /// The owner and the repository name - private static (string owner, string repositoryName) ParseRepoUri(string repositoryUri) - { - Regex repositoryUriPattern = new Regex(@"^/(?[^/]+)/(?[^/]+)/?$"); - Uri uri = new Uri(repositoryUri); - - Match match = repositoryUriPattern.Match(uri.AbsolutePath); - - if (!match.Success) - { - return default; - } - - return (match.Groups["owner"].Value, match.Groups["repo"].Value); - } - } -} diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/CollectionExtensions.cs b/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/CollectionExtensions.cs deleted file mode 100644 index dfe6aa27d6e..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/CollectionExtensions.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace Microsoft.DotNet.Git.IssueManager.Helpers -{ - internal static class CollectionExtensions - { - public static void AddRange(this Collection collection, IEnumerable items) - { - foreach (T item in items) - { - collection.Add(item); - } - } - } -} diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/RepositoryHelper.cs b/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/RepositoryHelper.cs deleted file mode 100644 index aeb18c58877..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/RepositoryHelper.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Git.IssueManager.Clients; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Microsoft.DotNet.Git.IssueManager.Helpers -{ - static class RepositoryHelper - { - public static async Task GetCommitAuthorAsync( - string repositoryUrl, - string commit, - string gitHubPersonalAccessToken, - string azureDevOpsPersonalAccessToken) - { - if (Uri.TryCreate(repositoryUrl, UriKind.Absolute, out Uri parsedUri)) - { - if (parsedUri.Host == "github.com") - { - if (string.IsNullOrEmpty(gitHubPersonalAccessToken)) - { - throw new ArgumentException("A GitHub personal access token is needed for this operation."); - } - - return await GitHubClient.GetCommitAuthorAsync(repositoryUrl, commit, gitHubPersonalAccessToken); - } - - if (string.IsNullOrEmpty(azureDevOpsPersonalAccessToken)) - { - throw new ArgumentException("An Azure DevOps personal access token is needed for this operation."); - } - - return await AzureDevOpsClient.GetCommitAuthorAsync(repositoryUrl, commit, azureDevOpsPersonalAccessToken); - } - - throw new InvalidCastException($"'{parsedUri}' is not a valid URI"); - } - - public static async Task CreateNewIssueAsync( - string repositoryUrl, - string issueTitle, - string issueDescription, - string gitHubPersonalAccessToken, - int? milestone = null, - IEnumerable labels = null, - IEnumerable assignees = null) - { - if (Uri.TryCreate(repositoryUrl, UriKind.Absolute, out Uri parsedUri)) - { - if (parsedUri.Host == "github.com") - { - if (string.IsNullOrEmpty(gitHubPersonalAccessToken)) - { - throw new ArgumentException("A GitHub personal access token is needed for this operation."); - } - - return await GitHubClient.CreateNewIssueAsync( - repositoryUrl, - issueTitle, - issueDescription, - gitHubPersonalAccessToken, - milestone, - labels, - assignees); - } - - throw new NotImplementedException("Creating issues is not currently supported for an Azure DevOps repo."); - } - - throw new InvalidCastException($"'{parsedUri}' is not a valid URI"); - } - - public static async Task CreateNewIssueCommentAsync( - string repositoryUrl, - int issueNumber, - string comment, - string gitHubPersonalAccessToken) - { - if (Uri.TryCreate(repositoryUrl, UriKind.Absolute, out Uri parsedUri)) - { - if (parsedUri.Host == "github.com") - { - if (string.IsNullOrEmpty(gitHubPersonalAccessToken)) - { - throw new ArgumentException("A GitHub personal access token is needed for this operation."); - } - - return await GitHubClient.CreateNewIssueCommentAsync( - repositoryUrl, - issueNumber, - comment, - gitHubPersonalAccessToken); - } - - throw new NotImplementedException("Creating comments is not currently supported for an Azure DevOps repo."); - } - - throw new InvalidCastException($"'{parsedUri}' is not a valid URI"); - } - } -} diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/IssueManager.cs b/src/Microsoft.DotNet.Git.IssueManager/src/IssueManager.cs deleted file mode 100644 index f0bfce1ea7b..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/IssueManager.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Git.IssueManager.Helpers; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Microsoft.DotNet.Git.IssueManager -{ - public class IssueManager - { - public string GitHubPersonalAccessToken { get; set; } - - public string AzureDevOpsPersonalAccessToken { get; set; } - - public IssueManager( - string gitHubPersonalAccessToken = null, - string azureDevOpsPersonalAccessToken = null) - { - GitHubPersonalAccessToken = gitHubPersonalAccessToken; - AzureDevOpsPersonalAccessToken = azureDevOpsPersonalAccessToken; - } - - /// - /// Gets the author of a commit from a repo+commit - /// - /// The repository URL - /// The commit SHA. - /// In GitHub returns the handle, in AzDO returns the full name. - public async Task GetCommitAuthorAsync(string repositoryUrl, string commit) - { - if (string.IsNullOrEmpty(repositoryUrl)) - { - throw new ArgumentException(nameof(repositoryUrl)); - } - - if (string.IsNullOrEmpty(commit)) - { - throw new ArgumentException(nameof(commit)); - } - - return await RepositoryHelper.GetCommitAuthorAsync(repositoryUrl, commit, GitHubPersonalAccessToken, AzureDevOpsPersonalAccessToken); - - } - - /// - /// Creates a new GitHub issue. - /// - /// Repository URL where to create the issue. - /// Title of the issue. - /// Description of the issue. - /// - public async Task CreateNewIssueAsync( - string repositoryUrl, - string issueTitle, - string issueDescription, - int? milestone = null, - IEnumerable labels = null, - IEnumerable assignees = null) - { - return await RepositoryHelper.CreateNewIssueAsync( - repositoryUrl, - issueTitle, - issueDescription, - GitHubPersonalAccessToken, - milestone, - labels, - assignees); - } - - /// - /// Creates a new comment on a GitHub issue. - /// - /// Repository URL where to create the issue. - /// Title of the issue. - /// Description of the issue. - /// - public async Task CreateNewIssueCommentAsync( - string repositoryUrl, - int issueNumber, - string comment) - { - return await RepositoryHelper.CreateNewIssueCommentAsync( - repositoryUrl, - issueNumber, - comment, - GitHubPersonalAccessToken); - } - } -} diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Microsoft.DotNet.Git.IssueManager.csproj b/src/Microsoft.DotNet.Git.IssueManager/src/Microsoft.DotNet.Git.IssueManager.csproj deleted file mode 100644 index 07472d5b491..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Microsoft.DotNet.Git.IssueManager.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(NetMinimum);$(NetFrameworkMinimum) - false - true - true - - - - - - - - - - - - diff --git a/src/Microsoft.DotNet.Git.IssueManager/src/Models/AzureDevOpsCommit.cs b/src/Microsoft.DotNet.Git.IssueManager/src/Models/AzureDevOpsCommit.cs deleted file mode 100644 index 5180373b656..00000000000 --- a/src/Microsoft.DotNet.Git.IssueManager/src/Models/AzureDevOpsCommit.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; - -namespace Microsoft.DotNet.Git.IssueManager -{ - public class AzureDevOpsCommit - { - public List Value { get; set; } - } - - public class Value - { - public Author Author { get; set; } - } - - public class Author - { - public string Name { get; set; } - - public string Email { get; set; } - - public DateTime Date { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj b/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj index e0e56b3ae1c..cbff170aa23 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj @@ -27,7 +27,4 @@ - - - diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs index 3739b4d5d67..e03da99984b 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs @@ -333,9 +333,7 @@ public RestApiException(Request request, Response response, string responseConte Response = new ResponseWrapper(response, responseContent); } -#if NET [Obsolete] -#endif protected RestApiException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -345,9 +343,7 @@ protected RestApiException(SerializationInfo info, StreamingContext context) Response = JsonConvert.DeserializeObject(responseString, SerializerSettings); } -#if NET [Obsolete] -#endif public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -375,18 +371,14 @@ public RestApiException(Request request, Response response, string responseConte Body = body; } -#if NET [Obsolete] -#endif protected RestApiException(SerializationInfo info, StreamingContext context) : base(info, context) { Body = JsonConvert.DeserializeObject(info.GetString("Body")); } -#if NET [Obsolete] -#endif public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj b/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj index e6886316066..86aef8f40e5 100644 --- a/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj +++ b/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj @@ -26,7 +26,4 @@ - - - diff --git a/src/Microsoft.DotNet.Helix/Sdk/AzureDevOpsTask.cs b/src/Microsoft.DotNet.Helix/Sdk/AzureDevOpsTask.cs index a102acb64dc..e6e2b759a9c 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/AzureDevOpsTask.cs +++ b/src/Microsoft.DotNet.Helix/Sdk/AzureDevOpsTask.cs @@ -62,7 +62,6 @@ private async Task ExecuteAsync() // observed on Mac anyway. // https://github.com/dotnet/dnceng/issues/6410 -#if NET using SocketsHttpHandler handler = new SocketsHttpHandler { AllowAutoRedirect = false, @@ -88,13 +87,6 @@ private async Task ExecuteAsync() }; using (var client = new HttpClient(handler) -#else - using (var client = new HttpClient(new HttpClientHandler - { - AllowAutoRedirect = false, - CheckCertificateRevocationList = true, - }) -#endif { DefaultRequestHeaders = { diff --git a/src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs b/src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs deleted file mode 100644 index 9d6c80c8af3..00000000000 --- a/src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.Arcade.Common.Desktop; - -namespace Microsoft.DotNet.Helix -{ - public partial class BaseTask - { - static BaseTask() - { - AssemblyResolver.Enable(); - } - } -} diff --git a/src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs b/src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs index 76a6faa1848..59723ce43c2 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs +++ b/src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs @@ -60,7 +60,6 @@ public class FindDotNetCliPackage : MSBuildTaskBase public override void ConfigureServices(IServiceCollection collection) { -#if NET var socketsHandler = new SocketsHttpHandler { AllowAutoRedirect = true, @@ -85,9 +84,7 @@ public override void ConfigureServices(IServiceCollection collection) VerificationTimeIgnored = true, }; _httpMessageHandler = socketsHandler; -#else - _httpMessageHandler = new HttpClientHandler { CheckCertificateRevocationList = true }; -#endif + collection.TryAddSingleton(_httpMessageHandler); collection.TryAddSingleton(Log); } diff --git a/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj b/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj index 6e1b0a8cf9c..f9aa0f783e5 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj +++ b/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj @@ -1,10 +1,9 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) MSBuildSdk true - **/*.Desktop.* @@ -14,13 +13,8 @@ - - - - + @@ -29,12 +23,6 @@ - - - - - - - - $(MSBuildThisFileDirectory)net/Microsoft.DotNet.Helix.Sdk.dll - $(MSBuildThisFileDirectory)netframework/Microsoft.DotNet.Helix.Sdk.dll - - + $(MSBuildThisFileDirectory)net/Microsoft.DotNet.Helix.Sdk.dll Helix - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.MacOsPkg/Cli/Microsoft.DotNet.MacOsPkg.Cli.csproj b/src/Microsoft.DotNet.MacOsPkg/Cli/Microsoft.DotNet.MacOsPkg.Cli.csproj index c5ac6d05aea..a80c4f5f2ce 100644 --- a/src/Microsoft.DotNet.MacOsPkg/Cli/Microsoft.DotNet.MacOsPkg.Cli.csproj +++ b/src/Microsoft.DotNet.MacOsPkg/Cli/Microsoft.DotNet.MacOsPkg.Cli.csproj @@ -1,25 +1,20 @@ - - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) Exe enable true The MacOsPkg CLI tool is used for unpacking, packing, and validating MacOS .pkg files and nested .app bundles. Arcade Build Tool MacOS Pkg false + true + dotnet-macos-pkg - - + + - - true - dotnet-macos-pkg - - diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/Microsoft.DotNet.NuGetRepack.Tasks.csproj b/src/Microsoft.DotNet.NuGetRepack/tasks/Microsoft.DotNet.NuGetRepack.Tasks.csproj index 64d4a8c22a0..6672ff927b3 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tasks/Microsoft.DotNet.NuGetRepack.Tasks.csproj +++ b/src/Microsoft.DotNet.NuGetRepack/tasks/Microsoft.DotNet.NuGetRepack.Tasks.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true MSBuildSdk @@ -13,17 +13,9 @@ - - - - - - - - diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/src/AssemblyResolution.cs b/src/Microsoft.DotNet.NuGetRepack/tasks/src/AssemblyResolution.cs deleted file mode 100644 index 07d6a5d2fa6..00000000000 --- a/src/Microsoft.DotNet.NuGetRepack/tasks/src/AssemblyResolution.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#if NET472 - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.DotNet.Tools -{ - internal static class AssemblyResolution - { - internal static TaskLoggingHelper Log; - - public static void Initialize() - { - AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve; - } - - private static Assembly AssemblyResolve(object sender, ResolveEventArgs args) - { - var name = new AssemblyName(args.Name); - - if (!name.Name.Equals("System.Collections.Immutable", StringComparison.OrdinalIgnoreCase)) - { - return null; - } - - var fullPath = Path.Combine(Path.GetDirectoryName(typeof(AssemblyResolution).Assembly.Location), "System.Collections.Immutable.dll"); - - Assembly sci; - try - { - sci = Assembly.LoadFile(fullPath); - } - catch (Exception e) - { - Log?.LogWarning($"AssemblyResolve: exception while loading '{fullPath}': {e.Message}"); - return null; - } - - if (name.Version <= sci.GetName().Version) - { - Log?.LogMessage(MessageImportance.Low, $"AssemblyResolve: loaded '{fullPath}' to {AppDomain.CurrentDomain.FriendlyName}"); - return sci; - } - - return null; - } - } -} - -#endif diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs b/src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs index 0d9d22ec6a5..e715f80a5d4 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs @@ -17,15 +17,8 @@ namespace Microsoft.DotNet.Tools /// /// Replaces content of files in specified package with new content and updates version of the package. /// -#if NET472 - [LoadInSeparateAppDomain] - public sealed class ReplacePackageParts : AppDomainIsolatedTask - { - static ReplacePackageParts() => AssemblyResolution.Initialize(); -#else public sealed class ReplacePackageParts : Microsoft.Build.Utilities.Task { -#endif /// /// Full path to the package to process. /// @@ -67,9 +60,6 @@ public sealed class ReplacePackageParts : Microsoft.Build.Utilities.Task public override bool Execute() { -#if NET472 - AssemblyResolution.Log = Log; -#endif try { ExecuteImpl(); @@ -77,9 +67,6 @@ public override bool Execute() } finally { -#if NET472 - AssemblyResolution.Log = null; -#endif } } diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs b/src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs index 8f922025d15..751c56330df 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs @@ -10,15 +10,8 @@ namespace Microsoft.DotNet.Tools { -#if NET472 - [LoadInSeparateAppDomain] - public sealed class UpdatePackageVersionTask : AppDomainIsolatedTask - { - static UpdatePackageVersionTask() => AssemblyResolution.Initialize(); -#else public class UpdatePackageVersionTask : Microsoft.Build.Utilities.Task { -#endif public string VersionKind { get; set; } [Required] @@ -33,9 +26,6 @@ public class UpdatePackageVersionTask : Microsoft.Build.Utilities.Task public override bool Execute() { -#if NET472 - AssemblyResolution.Log = Log; -#endif try { ExecuteImpl(); @@ -43,9 +33,6 @@ public override bool Execute() } finally { -#if NET472 - AssemblyResolution.Log = null; -#endif } } diff --git a/src/Microsoft.DotNet.PackageTesting.Tests/Microsoft.DotNet.PackageTesting.Tests.csproj b/src/Microsoft.DotNet.PackageTesting.Tests/Microsoft.DotNet.PackageTesting.Tests.csproj index ed72ff9eaf6..e9aefcb4673 100644 --- a/src/Microsoft.DotNet.PackageTesting.Tests/Microsoft.DotNet.PackageTesting.Tests.csproj +++ b/src/Microsoft.DotNet.PackageTesting.Tests/Microsoft.DotNet.PackageTesting.Tests.csproj @@ -1,16 +1,12 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) - - - - diff --git a/src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj b/src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj index 74b80da5bfe..b968fabcaad 100644 --- a/src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj +++ b/src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) MSBuildSdk true true @@ -13,10 +13,6 @@ - - - - diff --git a/src/Microsoft.DotNet.PackageTesting/build/Microsoft.DotNet.PackageTesting.props b/src/Microsoft.DotNet.PackageTesting/build/Microsoft.DotNet.PackageTesting.props index 9eabfb1d4c4..b59d540b0fb 100644 --- a/src/Microsoft.DotNet.PackageTesting/build/Microsoft.DotNet.PackageTesting.props +++ b/src/Microsoft.DotNet.PackageTesting/build/Microsoft.DotNet.PackageTesting.props @@ -2,12 +2,11 @@ - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.PackageTesting.dll - $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.PackageTesting.dll + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.PackageTesting.dll - - - + + + diff --git a/src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj b/src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj index ab867e7a4a4..7557ee157ca 100644 --- a/src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj +++ b/src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true Common toolset for building shared frameworks and framework packs. @@ -30,12 +30,5 @@ - - - - - - - diff --git a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/BuildTask.props b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/BuildTask.props index 3314587321b..1d595945de5 100644 --- a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/BuildTask.props +++ b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/BuildTask.props @@ -4,13 +4,17 @@ - - $(MSBuildThisFileDirectory)../tools/net/ - $(MSBuildThisFileDirectory)../tools/netframework/ - - + $(MSBuildThisFileDirectory)../tools/net/ $(DotNetSharedFrameworkTaskDir)Microsoft.DotNet.SharedFramework.Sdk.dll + + + + + + + + diff --git a/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets b/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets index 3b2dbd56552..58f1d207ad2 100644 --- a/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets +++ b/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets @@ -181,7 +181,6 @@ - @@ -305,7 +304,6 @@ Text="The following files are missing entries in the templated manifest: @(_FilesMissingInManifestEntries, ' '). Add these file names with extensions to the 'PlatformManifestFileEntry' item group for the runtime pack and corresponding ref pack to include them in the platform manifest." /> - @@ -335,7 +333,6 @@ If the chosen RID doesn't have a superset of files for all shipping platforms, then you may have unexpected behavior when using the produced targeting pack. --> - @@ -393,7 +390,6 @@ - @@ -466,7 +462,6 @@ - @@ -495,7 +490,6 @@ DependencyGraphFilePath="$(IntermediateOutputPath)assembly-graph.dgml" /> - @@ -516,7 +510,6 @@ IgnoredTypes="@(IgnoredDuplicateType)" /> - diff --git a/src/Microsoft.DotNet.SignTool.Tests/Microsoft.DotNet.SignTool.Tests.csproj b/src/Microsoft.DotNet.SignTool.Tests/Microsoft.DotNet.SignTool.Tests.csproj index d5266900d99..7caecb048dc 100644 --- a/src/Microsoft.DotNet.SignTool.Tests/Microsoft.DotNet.SignTool.Tests.csproj +++ b/src/Microsoft.DotNet.SignTool.Tests/Microsoft.DotNet.SignTool.Tests.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) @@ -16,13 +16,6 @@ - - - - - <_TarToolPattern>@(_TarToolPath->'%(RootDir)%(Directory)')**\*.* - - - <_TarToolFiles Include="$(_TarToolPattern)" /> - - - - - - @@ -80,4 +61,5 @@ + diff --git a/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs b/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs index 488ddf0e89e..a499e77610f 100644 --- a/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs +++ b/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs @@ -279,7 +279,6 @@ private string GetWixToolPath() } private static string s_snPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "sn", "sn.exe"); - private static string s_tarToolPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "tar", "Microsoft.Dotnet.Tar.dll"); private static string s_pkgToolPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "pkg", "Microsoft.Dotnet.MacOsPkg.dll"); private string GetResourcePath(string name, string relativePath = null) @@ -341,11 +340,11 @@ private void ValidateGeneratedProject( // The path to DotNet will always be null in these tests, this will force // the signing logic to call our FakeBuildEngine.BuildProjectFile with a path // to the XML that store the content of the would be Microbuild sign request. - var signToolArgs = new SignToolArgs(_tmpDir, microBuildCorePath: "MicroBuildCorePath", testSign: true, dotnetPath: null, msbuildVerbosity: "quiet", _tmpDir, enclosingDir: "", "", wix3ToolsPath: wix3ToolsPath, wixToolsPath: wixToolsPath, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, dotnetTimeout: -1); + var signToolArgs = new SignToolArgs(_tmpDir, microBuildCorePath: "MicroBuildCorePath", testSign: true, dotnetPath: null, msbuildVerbosity: "quiet", _tmpDir, enclosingDir: "", "", wix3ToolsPath: wix3ToolsPath, wixToolsPath: wixToolsPath, pkgToolPath: s_pkgToolPath, dotnetTimeout: -1); var signTool = new FakeSignTool(signToolArgs, task.Log); // Passing null for the 3rd party check skip as this doesn't affect the generated project. - var configuration = new Configuration(signToolArgs.TempDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, additionalCertificateInfo, null, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log); + var configuration = new Configuration(signToolArgs.TempDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, additionalCertificateInfo, null, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log); var signingInput = configuration.GenerateListOfFiles(); var util = new BatchSignUtil( task.BuildEngine, @@ -393,7 +392,7 @@ private void ValidateFileSignInfos( var engine = new FakeBuildEngine(); var task = new SignToolTask { BuildEngine = engine }; var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, additionalCertificateInfo, - skip3rdPartyCheckFiles, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles(); + skip3rdPartyCheckFiles, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles(); signingInput.FilesToSign.Select(f => f.ToString()).Should().BeEquivalentTo(expected); signingInput.FilesToCopy.Select(f => $"{f.Key} -> {f.Value}").Should().BeEquivalentTo(expectedCopyFiles ?? Array.Empty()); @@ -534,7 +533,7 @@ public void EmptySigningList() var fileSignInfo = new Dictionary(); var task = new SignToolTask { BuildEngine = new FakeBuildEngine() }; - var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, null, null, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles(); + var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, null, null, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles(); signingInput.FilesToSign.Should().BeEmpty(); signingInput.ZipDataMap.Should().BeEmpty(); @@ -2758,7 +2757,6 @@ public void ValidateSignToolTaskParsing() MicroBuildCorePath = "MicroBuildCorePath", DoStrongNameCheck = false, SNBinaryPath = null, - TarToolPath = s_tarToolPath, PkgToolPath = s_pkgToolPath, }; @@ -3129,7 +3127,6 @@ public void MissingCertificateName(string extension) new Dictionary>(), new(), null, - tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log) @@ -3180,7 +3177,6 @@ public void MissingCertificateNameButExtensionIsIgnored(string extension) extensionSignInfo, new(), null, - tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log) @@ -3543,7 +3539,6 @@ public void TestSignShouldNotValidateNuGetSignatures() snBinaryPath: "MockSnPath", wix3ToolsPath: null, wixToolsPath: null, - tarToolPath: null, pkgToolPath: null, dotnetTimeout: 300000); diff --git a/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj b/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj index 6e87e071b39..b7e7a172419 100644 --- a/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj +++ b/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true true @@ -12,10 +12,6 @@ lib - - - - @@ -30,11 +26,6 @@ - - - - - diff --git a/src/Microsoft.DotNet.SignTool/build/Microsoft.DotNet.SignTool.props b/src/Microsoft.DotNet.SignTool/build/Microsoft.DotNet.SignTool.props index 125962ae353..7daf24cbdb1 100644 --- a/src/Microsoft.DotNet.SignTool/build/Microsoft.DotNet.SignTool.props +++ b/src/Microsoft.DotNet.SignTool/build/Microsoft.DotNet.SignTool.props @@ -2,10 +2,9 @@ - $(MSBuildThisFileDirectory)..\lib\net\Microsoft.DotNet.SignTool.dll - $(MSBuildThisFileDirectory)..\lib\netframework\Microsoft.DotNet.SignTool.dll + $(MSBuildThisFileDirectory)..\lib\net\Microsoft.DotNet.SignTool.dll - + diff --git a/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs b/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs index ecd63cf0009..c432bbef441 100644 --- a/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs +++ b/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs @@ -282,7 +282,7 @@ void repackContainer(FileSignInfo file) if (file.IsUnpackableContainer()) { _log.LogMessage($"Repacking container: '{file.FileName}'"); - _batchData.ZipDataMap[file.FileContentKey].Repack(_log, _signTool.TempDir, _signTool.Wix3ToolsPath, _signTool.WixToolsPath, _signTool.TarToolPath, _signTool.PkgToolPath); + _batchData.ZipDataMap[file.FileContentKey].Repack(_log, _signTool.TempDir, _signTool.Wix3ToolsPath, _signTool.WixToolsPath, _signTool.PkgToolPath); } else { diff --git a/src/Microsoft.DotNet.SignTool/src/Configuration.cs b/src/Microsoft.DotNet.SignTool/src/Configuration.cs index 074a9528ae0..88faa5c2734 100644 --- a/src/Microsoft.DotNet.SignTool/src/Configuration.cs +++ b/src/Microsoft.DotNet.SignTool/src/Configuration.cs @@ -98,8 +98,6 @@ internal class Configuration private Telemetry _telemetry; - private string _tarToolPath; - private string _pkgToolPath; private string _snPath; @@ -115,7 +113,6 @@ public Configuration( Dictionary> extensionSignInfo, Dictionary> additionalCertificateInformation, HashSet itemsToSkip3rdPartyCheck, - string tarToolPath, string pkgToolPath, string snPath, TaskLoggingHelper log, @@ -145,7 +142,6 @@ public Configuration( _wixPacks = _itemsToSign.Where(w => WixPackInfo.IsWixPack(w.FullPath))?.Select(s => new WixPackInfo(s.FullPath)).ToList(); _hashToCollisionIdMap = new Dictionary(); _telemetry = telemetry; - _tarToolPath = tarToolPath; _pkgToolPath = pkgToolPath; _snPath = snPath; _itemsToSkip3rdPartyCheck = itemsToSkip3rdPartyCheck; @@ -805,7 +801,7 @@ private bool TryBuildZipData(FileSignInfo zipFileSignInfo, out ZipData zipData, { var nestedParts = new Dictionary(); - foreach (var entry in ZipData.ReadEntries(archivePath, _pathToContainerUnpackingDirectory, _tarToolPath, _pkgToolPath)) + foreach (var entry in ZipData.ReadEntries(archivePath, _pathToContainerUnpackingDirectory, _pkgToolPath)) { using (entry) { diff --git a/src/Microsoft.DotNet.SignTool/src/SignTool.cs b/src/Microsoft.DotNet.SignTool/src/SignTool.cs index 6b88e6d156b..517912d9c80 100644 --- a/src/Microsoft.DotNet.SignTool/src/SignTool.cs +++ b/src/Microsoft.DotNet.SignTool/src/SignTool.cs @@ -26,7 +26,6 @@ internal abstract class SignTool internal string Wix3ToolsPath => _args.Wix3ToolsPath; internal string WixToolsPath => _args.WixToolsPath; - internal string TarToolPath => _args.TarToolPath; internal string PkgToolPath => _args.PkgToolPath; internal SignTool(SignToolArgs args, TaskLoggingHelper log) @@ -126,14 +125,7 @@ private void UnzipMacFiles(Dictionary zippedOSXFiles) } else { - // Delete the file first so that we can overwrite it. ExtractToDirectory's overwrite is not - // available on framework. -#if NETFRAMEWORK - File.Delete(item.Key); - ZipFile.ExtractToDirectory(item.Value, Path.GetDirectoryName(item.Key)); -#else ZipFile.ExtractToDirectory(item.Value, Path.GetDirectoryName(item.Key), true); -#endif } File.Delete(item.Value); diff --git a/src/Microsoft.DotNet.SignTool/src/SignToolArgs.cs b/src/Microsoft.DotNet.SignTool/src/SignToolArgs.cs index c65a2def62c..5c011713237 100644 --- a/src/Microsoft.DotNet.SignTool/src/SignToolArgs.cs +++ b/src/Microsoft.DotNet.SignTool/src/SignToolArgs.cs @@ -15,11 +15,10 @@ internal readonly struct SignToolArgs internal string EnclosingDir { get; } internal string Wix3ToolsPath { get; } internal string WixToolsPath { get; } - internal string TarToolPath { get; } internal string PkgToolPath { get; } internal int DotNetTimeout { get; } - internal SignToolArgs(string tempPath, string microBuildCorePath, bool testSign, string dotnetPath, string msbuildVerbosity, string logDir, string enclosingDir, string snBinaryPath, string wix3ToolsPath, string wixToolsPath, string tarToolPath, string pkgToolPath, int dotnetTimeout) + internal SignToolArgs(string tempPath, string microBuildCorePath, bool testSign, string dotnetPath, string msbuildVerbosity, string logDir, string enclosingDir, string snBinaryPath, string wix3ToolsPath, string wixToolsPath, string pkgToolPath, int dotnetTimeout) { TempDir = tempPath; MicroBuildCorePath = microBuildCorePath; @@ -31,7 +30,6 @@ internal SignToolArgs(string tempPath, string microBuildCorePath, bool testSign, SNBinaryPath = snBinaryPath; Wix3ToolsPath = wix3ToolsPath; WixToolsPath = wixToolsPath; - TarToolPath = tarToolPath; PkgToolPath = pkgToolPath; DotNetTimeout = dotnetTimeout; } diff --git a/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs b/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs index 8350a285c22..c502664417e 100644 --- a/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs +++ b/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs @@ -2,11 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Build.Framework; -#if NET472 -using AppDomainIsolatedTask = Microsoft.Build.Utilities.AppDomainIsolatedTask; -#else using BuildTask = Microsoft.Build.Utilities.Task; -#endif using System; using System.Collections.Generic; using System.IO; @@ -16,15 +12,8 @@ namespace Microsoft.DotNet.SignTool { -#if NET472 - [LoadInSeparateAppDomain] - public class SignToolTask : AppDomainIsolatedTask - { - static SignToolTask() => AssemblyResolution.Initialize(); -#else public class SignToolTask : BuildTask { -#endif /// /// Perform validation but do not actually send signing request to the server. /// @@ -144,11 +133,6 @@ public class SignToolTask : BuildTask /// public string SNBinaryPath { get; set; } - /// - /// Path to Microsoft.DotNet.Tar.dll. Required for signing tar files on .NET Framework. - /// - public string TarToolPath { get; set; } - /// /// Path to Microsoft.DotNet.MacOsPkg.dll. Required for signing pkg files on MacOS. /// @@ -181,9 +165,6 @@ public class SignToolTask : BuildTask public override bool Execute() { -#if NET472 - AssemblyResolution.Log = Log; -#endif try { ExecuteImpl(); @@ -191,9 +172,6 @@ public override bool Execute() } finally { -#if NET472 - AssemblyResolution.Log = null; -#endif Log.LogMessage(MessageImportance.High, "SignToolTask execution finished."); } } @@ -253,7 +231,7 @@ public void ExecuteImpl() if (Log.HasLoggedErrors) return; - var signToolArgs = new SignToolArgs(TempDir, MicroBuildCorePath, TestSign, DotNetPath, MSBuildVerbosity, LogDir, enclosingDir, SNBinaryPath, Wix3ToolsPath, WixToolsPath, TarToolPath, PkgToolPath, DotNetTimeout); + var signToolArgs = new SignToolArgs(TempDir, MicroBuildCorePath, TestSign, DotNetPath, MSBuildVerbosity, LogDir, enclosingDir, SNBinaryPath, Wix3ToolsPath, WixToolsPath, PkgToolPath, DotNetTimeout); var signTool = DryRun ? new ValidationOnlySignTool(signToolArgs, Log) : (SignTool)new RealSignTool(signToolArgs, Log); var itemsToSign = ItemsToSign.Select(i => new ItemToSign(i.ItemSpec, i.GetMetadata(SignToolConstants.CollisionPriorityId))).OrderBy(i => i.CollisionPriorityId).ToList(); @@ -269,7 +247,6 @@ public void ExecuteImpl() extensionSignInfo, dualCertificates, filesToSkip3rdPartyCheck, - tarToolPath: TarToolPath, pkgToolPath: PkgToolPath, snPath: SNBinaryPath, Log, diff --git a/src/Microsoft.DotNet.SignTool/src/VerifySignatures.cs b/src/Microsoft.DotNet.SignTool/src/VerifySignatures.cs index da4b1ae2610..4df6c975ac2 100644 --- a/src/Microsoft.DotNet.SignTool/src/VerifySignatures.cs +++ b/src/Microsoft.DotNet.SignTool/src/VerifySignatures.cs @@ -25,16 +25,9 @@ namespace Microsoft.DotNet.SignTool { internal class VerifySignatures { -#if !NET472 private static readonly HttpClient client = new(new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(10) }); -#endif internal static SigningStatus IsSignedDeb(TaskLoggingHelper log, string filePath) { -# if NET472 - // Debian unpack tooling is not supported on .NET Framework - log.LogMessage(MessageImportance.Low, $"Skipping signature verification of {filePath} for .NET Framework"); - return SigningStatus.Unknown; -# else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { log.LogMessage(MessageImportance.Low, $"Skipping signature verification of {filePath} for Windows."); @@ -66,16 +59,10 @@ internal static SigningStatus IsSignedDeb(TaskLoggingHelper log, string filePath { Directory.Delete(tempDir, true); } -# endif } internal static SigningStatus IsSignedRpm(TaskLoggingHelper log, string filePath) { -# if NET472 - // RPM unpack tooling is not supported on .NET Framework - log.LogMessage(MessageImportance.Low, $"Skipping signature verification of {filePath} for .NET Framework"); - return SigningStatus.Unknown; -# else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { log.LogMessage(MessageImportance.Low, $"Skipping signature verification of {filePath} for Windows."); @@ -122,7 +109,6 @@ internal static SigningStatus IsSignedRpm(TaskLoggingHelper log, string filePath { Directory.Delete(tempDir, true); } -# endif } internal static SigningStatus IsSignedPowershellFile(string filePath) @@ -137,32 +123,6 @@ internal static SigningStatus IsSignedNupkg(string filePath) using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(filePath))) { isSigned = SignedPackageArchiveUtility.IsSigned(binaryReader); -#if NETFRAMEWORK - if (isSigned) - { - try - { - // A package will fail integrity checks if, for example, the package is signed and then: - // - it is repacked - // - it has its symbols stripped - // - it is otherwise modified - using (Stream stream = SignedPackageArchiveUtility.OpenPackageSignatureFileStream(binaryReader)) - { - using (PackageArchiveReader par = new PackageArchiveReader(filePath)) - { - var signature = par.GetPrimarySignatureAsync(CancellationToken.None).Result; - - var task = par.ValidateIntegrityAsync(signature.SignatureContent, CancellationToken.None); - task.Wait(); - } - } - } - catch (Exception) - { - isSigned = false; - } - } -#endif } return isSigned ? SigningStatus.Signed : SigningStatus.NotSigned; } @@ -257,7 +217,6 @@ private static string RunCommand(string command, bool throwOnError = true) } } -# if !NET472 private static void DownloadAndConfigurePublicKeys(string tempDir) { string[] keyUrls = new string[] @@ -301,6 +260,5 @@ private static string ExtractDebContainerEntry(string debianPackage, string entr return entryPath; } -# endif } } diff --git a/src/Microsoft.DotNet.SignTool/src/ZipData.cs b/src/Microsoft.DotNet.SignTool/src/ZipData.cs index 8f8a0ffb0cb..38bbd69f3d4 100644 --- a/src/Microsoft.DotNet.SignTool/src/ZipData.cs +++ b/src/Microsoft.DotNet.SignTool/src/ZipData.cs @@ -14,12 +14,7 @@ using System.Runtime.InteropServices; using NuGet.Packaging; using Microsoft.DotNet.Build.Tasks.Installers; - -#if NET472 -using System.IO.Packaging; -#else using System.Formats.Tar; -#endif namespace Microsoft.DotNet.SignTool { @@ -54,20 +49,15 @@ internal ZipData(FileSignInfo fileSignInfo, ImmutableDictionary return null; } - public static IEnumerable ReadEntries(string archivePath, string tempDir, string tarToolPath, string pkgToolPath, bool ignoreContent = false) + public static IEnumerable ReadEntries(string archivePath, string tempDir, string pkgToolPath, bool ignoreContent = false) { if (FileSignInfo.IsTarGZip(archivePath)) { - // Tar APIs not available on .NET FX. We need sign tool to run on desktop msbuild because building VSIX packages requires desktop. -#if NET472 - return ReadTarGZipEntries(archivePath, tempDir, tarToolPath, ignoreContent); -#else return ReadTarGZipEntries(archivePath) .Select(static entry => new ZipDataEntry(entry.Name, entry.DataStream, entry.Length) { UnixFileMode = (uint)entry.Mode, }); -#endif } else if (FileSignInfo.IsPkg(archivePath) || FileSignInfo.IsAppBundle(archivePath)) { @@ -75,24 +65,16 @@ public static IEnumerable ReadEntries(string archivePath, string t } else if (FileSignInfo.IsDeb(archivePath)) { -#if NET472 - throw new NotImplementedException("Debian signing is not supported on .NET Framework"); -#else return ReadDebContainerEntries(archivePath, "data.tar"); -#endif } else if (FileSignInfo.IsRpm(archivePath)) { -#if NET472 - throw new NotImplementedException("RPM signing is not supported on .NET Framework"); -#else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { throw new NotImplementedException("RPM signing is only supported on Linux platform"); } return ReadRpmContainerEntries(archivePath); -#endif } else { @@ -103,18 +85,15 @@ public static IEnumerable ReadEntries(string archivePath, string t /// /// Repack the zip container with the signed files. /// - public void Repack(TaskLoggingHelper log, string tempDir, string wix3ToolsPath, string wixToolsPath, string tarToolPath, string pkgToolPath) + public void Repack(TaskLoggingHelper log, string tempDir, string wix3ToolsPath, string wixToolsPath, string pkgToolPath) { -#if NET472 if (FileSignInfo.IsVsix()) { RepackPackage(log); } - else -#endif - if (FileSignInfo.IsTarGZip()) + else if (FileSignInfo.IsTarGZip()) { - RepackTarGZip(log, tempDir, tarToolPath); + RepackTarGZip(log, tempDir); } else if (FileSignInfo.IsUnpackableWixContainer()) { @@ -126,24 +105,16 @@ public void Repack(TaskLoggingHelper log, string tempDir, string wix3ToolsPath, } else if (FileSignInfo.IsDeb()) { -#if NET472 - throw new NotImplementedException("Debian signing is not supported on .NET Framework"); -#else RepackDebContainer(log, tempDir); -#endif } else if (FileSignInfo.IsRpm()) { -#if NET472 - throw new NotImplementedException("RPM signing is not supported on .NET Framework"); -#else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { throw new NotImplementedException("RPM signing is only supported on Linux platform"); } RepackRpmContainer(log, tempDir); -#endif } else { @@ -151,7 +122,6 @@ public void Repack(TaskLoggingHelper log, string tempDir, string wix3ToolsPath, } } -#if NET472 /// /// Repack a zip container with a package structure. /// @@ -191,7 +161,6 @@ string getPartRelativeFileName(PackagePart part) } } } -#endif private static IEnumerable ReadZipEntries(string archivePath) { @@ -353,9 +322,6 @@ private static IEnumerable ReadPkgOrAppBundleEntries(string archiv private void RepackPkgOrAppBundles(TaskLoggingHelper log, string tempDir, string pkgToolPath) { -#if NET472 - throw new NotImplementedException("PKG manipulation is not supported on .NET Framework"); -#else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { log.LogError("Pkg/AppBundle repackaging is not supported on Windows."); @@ -401,89 +367,9 @@ private void RepackPkgOrAppBundles(TaskLoggingHelper log, string tempDir, string Directory.Delete(extractDir, recursive: true); } } -#endif - } - -#if NETFRAMEWORK - private static bool RunTarProcess(string srcPath, string dstPath, string tarToolPath) - { - var process = Process.Start(new ProcessStartInfo() - { - FileName = "dotnet", - Arguments = $@"exec ""{tarToolPath}"" ""{srcPath}"" ""{dstPath}""", - UseShellExecute = false - }); - - process.WaitForExit(); - return process.ExitCode == 0; } - private static IEnumerable ReadTarGZipEntries(string archivePath, string tempDir, string tarToolPath, bool ignoreContent) - { - var extractDir = Path.Combine(tempDir, Guid.NewGuid().ToString()); - try - { - Directory.CreateDirectory(extractDir); - - if (!RunTarProcess(archivePath, extractDir, tarToolPath)) - { - throw new Exception($"Failed to unpack tar archive: {archivePath}"); - } - - foreach (var path in Directory.EnumerateFiles(extractDir, "*.*", SearchOption.AllDirectories)) - { - var relativePath = path.Substring(extractDir.Length + 1).Replace(Path.DirectorySeparatorChar, '/'); - using var stream = ignoreContent ? null : (Stream)File.Open(path, FileMode.Open); - yield return new ZipDataEntry(relativePath, stream); - } - } - finally - { - Directory.Delete(extractDir, recursive: true); - } - } - - private void RepackTarGZip(TaskLoggingHelper log, string tempDir, string tarToolPath) - { - var extractDir = Path.Combine(tempDir, Guid.NewGuid().ToString()); - try - { - Directory.CreateDirectory(extractDir); - - if (!RunTarProcess(srcPath: FileSignInfo.FullPath, dstPath: extractDir, tarToolPath)) - { - log.LogMessage(MessageImportance.Low, $"Failed to unpack tar archive: dotnet {tarToolPath} {FileSignInfo.FullPath}"); - return; - } - - foreach (var path in Directory.EnumerateFiles(extractDir, "*.*", SearchOption.AllDirectories)) - { - var relativePath = path.Substring(extractDir.Length + 1).Replace(Path.DirectorySeparatorChar, '/'); - - var signedPart = FindNestedPart(relativePath); - if (!signedPart.HasValue) - { - log.LogMessage(MessageImportance.Low, $"Didn't find signed part for nested file: {FileSignInfo.FullPath} -> {relativePath}"); - continue; - } - - log.LogMessage(MessageImportance.Low, $"Copying signed stream from {signedPart.Value.FileSignInfo.FullPath} to {FileSignInfo.FullPath} -> {relativePath}."); - File.Copy(signedPart.Value.FileSignInfo.FullPath, path, overwrite: true); - } - - if (!RunTarProcess(srcPath: extractDir, dstPath: FileSignInfo.FullPath, tarToolPath)) - { - log.LogMessage(MessageImportance.Low, $"Failed to pack tar archive: dotnet {tarToolPath} {FileSignInfo.FullPath}"); - return; - } - } - finally - { - Directory.Delete(extractDir, recursive: true); - } - } -#else - private void RepackTarGZip(TaskLoggingHelper log, string tempDir, string tarToolPath) + private void RepackTarGZip(TaskLoggingHelper log, string tempDir) { using MemoryStream streamToCompress = new(); using (TarWriter writer = new(streamToCompress, leaveOpen: true)) @@ -841,27 +727,20 @@ private static bool RunExternalProcess(TaskLoggingHelper log, string cmd, string return process.ExitCode == 0; } -#endif internal static void SetUnixFileMode(TaskLoggingHelper log, uint? unixFileMode, string outputPath) { -#if NET // Set file mode if not the default. if (!OperatingSystem.IsWindows() && unixFileMode is { } mode and not /* 0644 */ 420) { log.LogMessage(MessageImportance.Low, $"Setting file mode {Convert.ToString(mode, 8)} on: {outputPath}"); File.SetUnixFileMode(outputPath, (UnixFileMode)mode); } -#endif } private static uint? GetUnixFileMode(string filePath) { -#if NET return OperatingSystem.IsWindows() ? null : (uint)File.GetUnixFileMode(filePath); -#else - return null; -#endif } } } diff --git a/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj b/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj index 7f234c442ca..69c810807fa 100644 --- a/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj +++ b/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) MSBuildSdk true diff --git a/src/Microsoft.DotNet.SourceBuild/tasks/build/Microsoft.DotNet.SourceBuild.Tasks.props b/src/Microsoft.DotNet.SourceBuild/tasks/build/Microsoft.DotNet.SourceBuild.Tasks.props index 2f4a50b0697..73f7ae83dcf 100644 --- a/src/Microsoft.DotNet.SourceBuild/tasks/build/Microsoft.DotNet.SourceBuild.Tasks.props +++ b/src/Microsoft.DotNet.SourceBuild/tasks/build/Microsoft.DotNet.SourceBuild.Tasks.props @@ -2,12 +2,11 @@ - $(MSBuildThisFileDirectory)..\tools\net\$(MSBuildThisFileName).dll - $(MSBuildThisFileDirectory)..\tools\netframework\$(MSBuildThisFileName).dll + $(MSBuildThisFileDirectory)..\tools\net\$(MSBuildThisFileName).dll - - - + + + diff --git a/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj b/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj index fd542d9a6c3..ec08ef03c19 100644 --- a/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj +++ b/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj @@ -2,7 +2,6 @@ $(NetToolCurrent);$(NetFrameworkToolCurrent) - Library true true true @@ -10,15 +9,6 @@ Arcade Build Library Strong Name - - - - - - - - - diff --git a/src/Microsoft.DotNet.StrongName/Signing.cs b/src/Microsoft.DotNet.StrongName/Signing.cs index 97e81ef11ba..d7e629d7ab3 100644 --- a/src/Microsoft.DotNet.StrongName/Signing.cs +++ b/src/Microsoft.DotNet.StrongName/Signing.cs @@ -232,7 +232,7 @@ internal static void Sign(Stream peStream, string keyFile) /// /// Returns true if the PE file meets all of the pre-conditions to be Open Source Signed. - /// Returns false and logs msbuild errors otherwise. + /// Returns false otherwise. /// private static bool IsPublicSigned(PEReader peReader) { diff --git a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator.csproj b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator.csproj index 5287daca560..d4655c6d004 100644 --- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator.csproj +++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator.csproj @@ -1,7 +1,7 @@ - $(NetMinimum);netstandard2.0;$(NetFrameworkMinimum) + $(NetMinimum) Microsoft.DotNet.SwaggerGenerator true @@ -14,21 +14,10 @@ - - - - - - - - - - - diff --git a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj index 93477f78700..44e0916590e 100644 --- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj +++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true This package provides support for generating client library code from a swagger document. @@ -13,8 +13,4 @@ - - - - diff --git a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.props b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.props index 5c6c055458f..4e06d275305 100644 --- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.props +++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.props @@ -2,10 +2,8 @@ - $(MSBuildThisFileDirectory)../tools/net/ - $(MSBuildThisFileDirectory)../tools/netframework/ + $(MSBuildThisFileDirectory)../tools/net/ $(MicrosoftDotNetSwaggerGeneratorMSBuildDirectory)Microsoft.DotNet.SwaggerGenerator.MSBuild.dll - AssemblyTaskFactory $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', 'generated-code')) diff --git a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.targets b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.targets index b2af860ee86..767c52be40e 100644 --- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.targets +++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/build/Microsoft.DotNet.SwaggerGenerator.MSBuild.targets @@ -1,7 +1,7 @@ - + - - - $(NetToolCurrent);$(NetFrameworkToolCurrent) - Exe - true - true - Tar - Arcade Build Tool Tar - false - - - - true - dotnet-tar - - - diff --git a/src/Microsoft.DotNet.Tar/Program.cs b/src/Microsoft.DotNet.Tar/Program.cs deleted file mode 100644 index 8d68eb73096..00000000000 --- a/src/Microsoft.DotNet.Tar/Program.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#if NETFRAMEWORK - -System.Console.Error.WriteLine("Not supported on .NET Framework"); -return 1; - -#else - -using System; -using System.Formats.Tar; -using System.IO; -using System.IO.Compression; - -if (args is not [var srcPath, var dstPath]) -{ - Console.Error.WriteLine("Usage: "); - return 1; -} - -try -{ - if (File.Exists(srcPath)) - { - Directory.CreateDirectory(dstPath); - - using var srcStream = File.Open(srcPath, FileMode.Open); - using var gzip = new GZipStream(srcStream, CompressionMode.Decompress); - TarFile.ExtractToDirectory(gzip, dstPath, overwriteFiles: false); - - } - else if (Directory.Exists(srcPath)) - { - using var dstStream = File.Open(dstPath, FileMode.Create); - using var gzip = new GZipStream(dstStream, CompressionMode.Compress); - TarFile.CreateFromDirectory(srcPath, gzip, includeBaseDirectory: false); - } - else - { - Console.Error.WriteLine($"File or directory must exist: '{srcPath}'"); - return 1; - } -} -catch (Exception e) -{ - Console.Error.Write(e.Message); - return 1; -} - -return 0; - -#endif diff --git a/src/Microsoft.DotNet.XliffTasks/Microsoft.DotNet.XliffTasks.csproj b/src/Microsoft.DotNet.XliffTasks/Microsoft.DotNet.XliffTasks.csproj index 165a4a7d5fd..215b882c661 100644 --- a/src/Microsoft.DotNet.XliffTasks/Microsoft.DotNet.XliffTasks.csproj +++ b/src/Microsoft.DotNet.XliffTasks/Microsoft.DotNet.XliffTasks.csproj @@ -1,7 +1,7 @@ - $(NetToolMinimum);$(NetFrameworkToolCurrent) + $(NetToolMinimum) true true XliffTasks @@ -18,7 +18,6 @@ - diff --git a/src/Microsoft.DotNet.XliffTasks/build/Microsoft.DotNet.XliffTasks.targets b/src/Microsoft.DotNet.XliffTasks/build/Microsoft.DotNet.XliffTasks.targets index b0d7174e1ec..b4ff386fa93 100644 --- a/src/Microsoft.DotNet.XliffTasks/build/Microsoft.DotNet.XliffTasks.targets +++ b/src/Microsoft.DotNet.XliffTasks/build/Microsoft.DotNet.XliffTasks.targets @@ -2,19 +2,17 @@ - $(MSBuildThisFileDirectory)..\tools\net\ - $(MSBuildThisFileDirectory)..\tools\netframework\ + $(MSBuildThisFileDirectory)..\tools\net\ $(XliffTasksDirectory)Microsoft.DotNet.XliffTasks.dll - AssemblyTaskFactory - - - - - - - + + + + + + + + - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetFrameworkToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll + $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll @@ -43,9 +43,6 @@ - - - diff --git a/tests/XHarness.Tests.Common.props b/tests/XHarness.Tests.Common.props index 2c46db86366..564f46f88df 100644 --- a/tests/XHarness.Tests.Common.props +++ b/tests/XHarness.Tests.Common.props @@ -7,8 +7,7 @@ --> - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetFrameworkToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll + $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/$(NetToolCurrent)/publish/Microsoft.DotNet.Helix.Sdk.dll From 35ef0d6fa5f61d99e156c315c76b62a63c8bf741 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 15 Dec 2025 13:51:52 +0100 Subject: [PATCH 02/12] Restore tools in Tools.proj via PackageDownload --- .../tools/Tools.proj | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj index f77552c516d..a2a85214631 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj @@ -3,7 +3,7 @@ - + net472 @@ -34,7 +34,7 @@ - + @@ -45,23 +45,23 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -96,10 +96,10 @@ - + From 2a3f442601a80313f8355eb8970ade40dc47ba25 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 10:17:09 +0100 Subject: [PATCH 03/12] Make the repo build --- Directory.Packages.props | 4 +- eng/BuildTask.targets | 18 +- ...crosoft.DotNet.Build.Tasks.Archives.csproj | 3 +- ...oft.DotNet.Build.Tasks.VisualStudio.csproj | 1 + .../RoslynBuildTask.cs | 1 + .../Microsoft.DotNet.Helix.Client.csproj | 8 +- .../Microsoft.DotNet.Helix.JobSender.csproj | 6 +- .../Sdk/Microsoft.DotNet.Helix.Sdk.csproj | 2 +- .../Microsoft.DotNet.SignTool.csproj | 1 + src/Microsoft.DotNet.SignTool/src/ZipData.cs | 1 + .../Microsoft.DotNet.StrongName.csproj | 7 +- .../Interop/StructuredStorage.cs | 2 + .../Microsoft.DotNet.SignCheckLibrary.csproj | 45 +-- .../SignatureVerificationManager.cs | 24 +- .../Verification/VsixVerifier.cs | 299 +++++++++--------- src/SignCheck/README.md | 4 +- src/SignCheck/SignCheck/App.config | 6 - .../Microsoft.DotNet.SignCheck.csproj | 19 +- 18 files changed, 199 insertions(+), 252 deletions(-) delete mode 100644 src/SignCheck/SignCheck/App.config diff --git a/Directory.Packages.props b/Directory.Packages.props index a093ae1c0a5..580a91bd6b8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -89,14 +89,14 @@ - + - + diff --git a/eng/BuildTask.targets b/eng/BuildTask.targets index 6a3787512a9..80566a7edaa 100644 --- a/eng/BuildTask.targets +++ b/eng/BuildTask.targets @@ -8,8 +8,8 @@ true tools - true - $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore + net + $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackage - + @@ -64,11 +64,13 @@ - - - - net - + + + + + diff --git a/src/Microsoft.DotNet.Build.Tasks.Archives/Microsoft.DotNet.Build.Tasks.Archives.csproj b/src/Microsoft.DotNet.Build.Tasks.Archives/Microsoft.DotNet.Build.Tasks.Archives.csproj index 03301ff8e12..9cf0e45e04f 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Archives/Microsoft.DotNet.Build.Tasks.Archives.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Archives/Microsoft.DotNet.Build.Tasks.Archives.csproj @@ -1,10 +1,9 @@ - + $(NetToolCurrent) true true - false Targets for producing an archive of file outputs. MSBuildSdk diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj index 1a2a0cd1019..acf55e8f5ee 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio/Microsoft.DotNet.Build.Tasks.VisualStudio.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs b/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs index fa5389b6b82..c96e5c37b26 100644 --- a/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs +++ b/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs @@ -6,6 +6,7 @@ using System; using System.IO; using System.Reflection; +using System.Runtime.Loader; namespace Microsoft.DotNet.Build.Tasks { diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj b/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj index cbff170aa23..efd39e7f7ba 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/Microsoft.DotNet.Helix.Client.csproj @@ -2,7 +2,7 @@ - $(NetToolCurrent);netstandard2.0;$(NetFrameworkToolCurrent) + $(NetToolCurrent) true This package provides access to the Helix Api located at https://helix.dot.net/ https://helix.dot.net/api/openapi.json @@ -17,12 +17,6 @@ - - - - - - diff --git a/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj b/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj index 86aef8f40e5..3626edff4c9 100644 --- a/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj +++ b/src/Microsoft.DotNet.Helix/JobSender/Microsoft.DotNet.Helix.JobSender.csproj @@ -2,7 +2,7 @@ - $(NetToolCurrent);netstandard2.0;$(NetFrameworkToolCurrent) + $(NetToolCurrent) true Microsoft.DotNet.Helix.Client This package provides a simple API for constructing and sending jobs to the Helix Api @@ -18,10 +18,6 @@ - - - - diff --git a/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj b/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj index f9aa0f783e5..da6a1dffb04 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj +++ b/src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj b/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj index b7e7a172419..6b84b7fe0a0 100644 --- a/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj +++ b/src/Microsoft.DotNet.SignTool/Microsoft.DotNet.SignTool.csproj @@ -24,6 +24,7 @@ + diff --git a/src/Microsoft.DotNet.SignTool/src/ZipData.cs b/src/Microsoft.DotNet.SignTool/src/ZipData.cs index 38bbd69f3d4..85aeb7fcb2e 100644 --- a/src/Microsoft.DotNet.SignTool/src/ZipData.cs +++ b/src/Microsoft.DotNet.SignTool/src/ZipData.cs @@ -8,6 +8,7 @@ using System.Collections.Immutable; using System.IO; using System.IO.Compression; +using System.IO.Packaging; using System.Linq; using System.Data; using System.Diagnostics; diff --git a/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj b/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj index ec08ef03c19..1f75fc74ac8 100644 --- a/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj +++ b/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj @@ -1,7 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true true @@ -9,11 +9,6 @@ Arcade Build Library Strong Name - - - - - diff --git a/src/SignCheck/Microsoft.SignCheck/Interop/StructuredStorage.cs b/src/SignCheck/Microsoft.SignCheck/Interop/StructuredStorage.cs index 31f4fd3b30d..cb6306bc4ad 100644 --- a/src/SignCheck/Microsoft.SignCheck/Interop/StructuredStorage.cs +++ b/src/SignCheck/Microsoft.SignCheck/Interop/StructuredStorage.cs @@ -8,6 +8,8 @@ using Microsoft.VisualStudio.OLE.Interop; using STATSTG = Microsoft.VisualStudio.OLE.Interop.STATSTG; +#pragma warning disable CA1416 // Validate platform compatibility + namespace Microsoft.SignCheck.Interop { // This code is a C# adaptation of MSIX: diff --git a/src/SignCheck/Microsoft.SignCheck/Microsoft.DotNet.SignCheckLibrary.csproj b/src/SignCheck/Microsoft.SignCheck/Microsoft.DotNet.SignCheckLibrary.csproj index c43fe8f8cb7..1a05049812c 100644 --- a/src/SignCheck/Microsoft.SignCheck/Microsoft.DotNet.SignCheckLibrary.csproj +++ b/src/SignCheck/Microsoft.SignCheck/Microsoft.DotNet.SignCheckLibrary.csproj @@ -3,24 +3,26 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) Microsoft.SignCheck false - true true + + + + - @@ -38,43 +40,6 @@ CopyToOutputDirectory="PreserveNewest" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VerifySupportedFileType(path, parent, virtualPath); - private bool TryGetTimestamp(PackageDigitalSignature packageSignature, out Timestamp timestamp) - { - bool isValidTimestampSignature = false; - - if (packageSignature == null) - { - throw new ArgumentNullException(nameof(packageSignature)); - } - - timestamp = new Timestamp() - { - SignedOn = DateTime.MaxValue - }; - - XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable()); - namespaceManager.AddNamespace("ds", "http://schemas.openxmlformats.org/package/2006/digital-signature"); - - // Obtain timestamp from Signature Xml if there is one. - XmlElement element = packageSignature.Signature.GetXml(); - XmlNode encodedTimeNode = element.SelectNodes("//ds:TimeStamp/ds:EncodedTime", namespaceManager).OfType().FirstOrDefault(); - - // If timestamp found, verify it. - if (encodedTimeNode != null && encodedTimeNode.InnerText != null) - { - byte[] binaryTimestamp = null; - - try - { - binaryTimestamp = Convert.FromBase64String(encodedTimeNode.InnerText); - } - catch (FormatException) - { - return false; - } - - IntPtr TSContextPtr = IntPtr.Zero; - IntPtr TSSignerPtr = IntPtr.Zero; - IntPtr StoreHandle = IntPtr.Zero; - - // Ensure timestamp corresponds to package signature - isValidTimestampSignature = WinCrypt.CryptVerifyTimeStampSignature(binaryTimestamp, - (uint)binaryTimestamp.Length, - packageSignature.SignatureValue, - (uint)packageSignature.SignatureValue.Length, - IntPtr.Zero, - out TSContextPtr, - out TSSignerPtr, - out StoreHandle); - - if (isValidTimestampSignature) - { - var timestampContext = (CRYPT_TIMESTAMP_CONTEXT)Marshal.PtrToStructure(TSContextPtr, typeof(CRYPT_TIMESTAMP_CONTEXT)); - var timestampInfo = (CRYPT_TIMESTAMP_INFO)Marshal.PtrToStructure(timestampContext.pTimeStamp, typeof(CRYPT_TIMESTAMP_INFO)); - - unchecked - { - uint low = (uint)timestampInfo.ftTime.dwLowDateTime; - long ftTimestamp = (((long)timestampInfo.ftTime.dwHighDateTime) << 32) | low; - - timestamp.SignedOn = DateTime.FromFileTime(ftTimestamp); - } - - // Get the algorithm name based on the OID. - timestamp.SignatureAlgorithm = Oid.FromOidValue(timestampInfo.HashAlgorithm.pszObjId, OidGroup.HashAlgorithm).FriendlyName; - - X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); - timestamp.EffectiveDate = certificate.NotBefore; - timestamp.ExpiryDate = certificate.NotAfter; - } - - if (IntPtr.Zero != TSContextPtr) - { - WinCrypt.CryptMemFree(TSContextPtr); - } - if (IntPtr.Zero != TSSignerPtr) - { - WinCrypt.CertFreeCertificateContext(TSSignerPtr); - } - if (IntPtr.Zero != StoreHandle) - { - WinCrypt.CertCloseStore(StoreHandle, 0); - } - } - - return isValidTimestampSignature; - } + // private bool TryGetTimestamp(PackageDigitalSignature packageSignature, out Timestamp timestamp) + // { + // bool isValidTimestampSignature = false; + + // if (packageSignature == null) + // { + // throw new ArgumentNullException(nameof(packageSignature)); + // } + + // timestamp = new Timestamp() + // { + // SignedOn = DateTime.MaxValue + // }; + + // XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable()); + // namespaceManager.AddNamespace("ds", "http://schemas.openxmlformats.org/package/2006/digital-signature"); + + // // Obtain timestamp from Signature Xml if there is one. + // XmlElement element = packageSignature.Signature.GetXml(); + // XmlNode encodedTimeNode = element.SelectNodes("//ds:TimeStamp/ds:EncodedTime", namespaceManager).OfType().FirstOrDefault(); + + // // If timestamp found, verify it. + // if (encodedTimeNode != null && encodedTimeNode.InnerText != null) + // { + // byte[] binaryTimestamp = null; + + // try + // { + // binaryTimestamp = Convert.FromBase64String(encodedTimeNode.InnerText); + // } + // catch (FormatException) + // { + // return false; + // } + + // IntPtr TSContextPtr = IntPtr.Zero; + // IntPtr TSSignerPtr = IntPtr.Zero; + // IntPtr StoreHandle = IntPtr.Zero; + + // // Ensure timestamp corresponds to package signature + // isValidTimestampSignature = WinCrypt.CryptVerifyTimeStampSignature(binaryTimestamp, + // (uint)binaryTimestamp.Length, + // packageSignature.SignatureValue, + // (uint)packageSignature.SignatureValue.Length, + // IntPtr.Zero, + // out TSContextPtr, + // out TSSignerPtr, + // out StoreHandle); + + // if (isValidTimestampSignature) + // { + // var timestampContext = (CRYPT_TIMESTAMP_CONTEXT)Marshal.PtrToStructure(TSContextPtr, typeof(CRYPT_TIMESTAMP_CONTEXT)); + // var timestampInfo = (CRYPT_TIMESTAMP_INFO)Marshal.PtrToStructure(timestampContext.pTimeStamp, typeof(CRYPT_TIMESTAMP_INFO)); + + // unchecked + // { + // uint low = (uint)timestampInfo.ftTime.dwLowDateTime; + // long ftTimestamp = (((long)timestampInfo.ftTime.dwHighDateTime) << 32) | low; + + // timestamp.SignedOn = DateTime.FromFileTime(ftTimestamp); + // } + + // // Get the algorithm name based on the OID. + // timestamp.SignatureAlgorithm = Oid.FromOidValue(timestampInfo.HashAlgorithm.pszObjId, OidGroup.HashAlgorithm).FriendlyName; + + // X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); + // timestamp.EffectiveDate = certificate.NotBefore; + // timestamp.ExpiryDate = certificate.NotAfter; + // } + + // if (IntPtr.Zero != TSContextPtr) + // { + // WinCrypt.CryptMemFree(TSContextPtr); + // } + // if (IntPtr.Zero != TSSignerPtr) + // { + // WinCrypt.CertFreeCertificateContext(TSSignerPtr); + // } + // if (IntPtr.Zero != StoreHandle) + // { + // WinCrypt.CertCloseStore(StoreHandle, 0); + // } + // } + + // return isValidTimestampSignature; + // } protected override bool IsSigned(string path, SignatureVerificationResult result) { - PackageDigitalSignature packageSignature = null; - - using (var vsixStream = new FileStream(path, FileMode.Open, FileAccess.Read)) - { - var vsixPackage = Package.Open(vsixStream); - var signatureManager = new PackageDigitalSignatureManager(vsixPackage); - - if (!signatureManager.IsSigned) - { - return false; - } - - if (signatureManager.Signatures.Count() != 1) - { - return false; - } - - if (signatureManager.Signatures[0].SignedParts.Count != vsixPackage.GetParts().Count() - 1) - { - return false; - } - - packageSignature = signatureManager.Signatures[0]; - - // Retrieve the timestamp - Timestamp timestamp; - if (!TryGetTimestamp(packageSignature, out timestamp)) - { - // Timestamp is either invalid or not present - result.AddDetail(DetailKeys.Error, SignCheckResources.ErrorInvalidOrMissingTimestamp); - return false; - } - - // Update the result with the timestamp detail - result.AddDetail(DetailKeys.Signature, String.Format(SignCheckResources.DetailTimestamp, timestamp.SignedOn, timestamp.SignatureAlgorithm)); - - // Verify the certificate chain - X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); - - X509Chain certChain = new X509Chain(); - certChain.ChainPolicy.RevocationFlag = X509RevocationFlag.ExcludeRoot; - certChain.ChainPolicy.RevocationMode = X509RevocationMode.Online; - - // If the certificate has expired, but the VSIX was signed prior to expiration - // we can ignore invalid time policies. - bool certExpired = DateTime.Now > certificate.NotAfter; - - if (timestamp.IsValid && certExpired) - { - certChain.ChainPolicy.VerificationFlags |= X509VerificationFlags.IgnoreNotTimeValid; - } - - if (!certChain.Build(certificate)) - { - result.AddDetail(DetailKeys.Error, SignCheckResources.DetailErrorFailedToBuildCertChain); - return false; - } - - result.AddDetail(DetailKeys.Misc, SignCheckResources.DetailCertChainValid); - } - - return true; + // TODO: Fix this + throw new NotImplementedException(); + + // PackageDigitalSignature packageSignature = null; + + // using (var vsixStream = new FileStream(path, FileMode.Open, FileAccess.Read)) + // { + // var vsixPackage = Package.Open(vsixStream); + // var signatureManager = new PackageDigitalSignatureManager(vsixPackage); + + // if (!signatureManager.IsSigned) + // { + // return false; + // } + + // if (signatureManager.Signatures.Count() != 1) + // { + // return false; + // } + + // if (signatureManager.Signatures[0].SignedParts.Count != vsixPackage.GetParts().Count() - 1) + // { + // return false; + // } + + // packageSignature = signatureManager.Signatures[0]; + + // // Retrieve the timestamp + // Timestamp timestamp; + // if (!TryGetTimestamp(packageSignature, out timestamp)) + // { + // // Timestamp is either invalid or not present + // result.AddDetail(DetailKeys.Error, SignCheckResources.ErrorInvalidOrMissingTimestamp); + // return false; + // } + + // // Update the result with the timestamp detail + // result.AddDetail(DetailKeys.Signature, String.Format(SignCheckResources.DetailTimestamp, timestamp.SignedOn, timestamp.SignatureAlgorithm)); + + // // Verify the certificate chain + // X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); + + // X509Chain certChain = new X509Chain(); + // certChain.ChainPolicy.RevocationFlag = X509RevocationFlag.ExcludeRoot; + // certChain.ChainPolicy.RevocationMode = X509RevocationMode.Online; + + // // If the certificate has expired, but the VSIX was signed prior to expiration + // // we can ignore invalid time policies. + // bool certExpired = DateTime.Now > certificate.NotAfter; + + // if (timestamp.IsValid && certExpired) + // { + // certChain.ChainPolicy.VerificationFlags |= X509VerificationFlags.IgnoreNotTimeValid; + // } + + // if (!certChain.Build(certificate)) + // { + // result.AddDetail(DetailKeys.Error, SignCheckResources.DetailErrorFailedToBuildCertChain); + // return false; + // } + + // result.AddDetail(DetailKeys.Misc, SignCheckResources.DetailCertChainValid); + // } + + // return true; } } } diff --git a/src/SignCheck/README.md b/src/SignCheck/README.md index 8efe1ca824b..cb8d4645408 100644 --- a/src/SignCheck/README.md +++ b/src/SignCheck/README.md @@ -37,10 +37,10 @@ The CLI tool is maintained for legacy purposes and is only recommended for repos - **Supported Frameworks**: .NET Framework only - **Invocation**: - - `Microsoft.DotNet.SignCheck.exe` + - `dnx Microsoft.DotNet.SignCheck` - **CLI Options**: ``` -Microsoft.DotNet.SignCheck.exe [options] +Microsoft.DotNet.SignCheck [options] Options: diff --git a/src/SignCheck/SignCheck/App.config b/src/SignCheck/SignCheck/App.config deleted file mode 100644 index 731f6de6c29..00000000000 --- a/src/SignCheck/SignCheck/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj b/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj index d0628c78798..37845d68869 100644 --- a/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj +++ b/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj @@ -3,31 +3,20 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) Exe - true false true - - true Build artifact signing validation tool Arcade Signing Validation Tool SignCheck + true + signcheck - + - - - - - - - - From 6092d6baac7ce921dfaa0922fc24fee62dad51e7 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 10:23:36 +0100 Subject: [PATCH 04/12] Fix SwaggerGenerator in tree execution --- .../Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj index 44e0916590e..09a6cfdecbf 100644 --- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj +++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/Microsoft.DotNet.SwaggerGenerator.MSBuild.csproj @@ -6,6 +6,7 @@ true This package provides support for generating client library code from a swagger document. true + true From fe5938ed33650eab90d8f0b3eaca510df52bcb8c Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 10:30:37 +0100 Subject: [PATCH 05/12] Delete dead test project --- ...soft.DotNet.VersionTools.Tasks.Tests.csproj | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/VersionTools/Microsoft.DotNet.VersionTools.Tasks.Tests/Microsoft.DotNet.VersionTools.Tasks.Tests.csproj diff --git a/src/VersionTools/Microsoft.DotNet.VersionTools.Tasks.Tests/Microsoft.DotNet.VersionTools.Tasks.Tests.csproj b/src/VersionTools/Microsoft.DotNet.VersionTools.Tasks.Tests/Microsoft.DotNet.VersionTools.Tasks.Tests.csproj deleted file mode 100644 index deac5bd978a..00000000000 --- a/src/VersionTools/Microsoft.DotNet.VersionTools.Tasks.Tests/Microsoft.DotNet.VersionTools.Tasks.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - $(NetToolCurrent) - - - - - - - - - - - - - - From 28533820e08fa794e6c7b684732f2dca47edaf61 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 12:04:53 +0100 Subject: [PATCH 06/12] SourceBuild fix --- eng/BuildTask.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/BuildTask.targets b/eng/BuildTask.targets index 80566a7edaa..f5c12d0a3ec 100644 --- a/eng/BuildTask.targets +++ b/eng/BuildTask.targets @@ -67,7 +67,8 @@ + DependsOnTargets="Publish" + Condition="'$(_SuppressAllTargets)' != 'true'" /> From 56ace86e8c752ee40a9e739258e252e7158ad534 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 12:16:00 +0100 Subject: [PATCH 07/12] Fix source-build exclusion --- src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj b/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj index 37845d68869..932757f9442 100644 --- a/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj +++ b/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj @@ -12,6 +12,7 @@ SignCheck true signcheck + true From 7b495806a094147c0158c92f499fd21ae600781b Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 14:07:41 +0100 Subject: [PATCH 08/12] Try to fix race --- eng/BuildTask.targets | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/eng/BuildTask.targets b/eng/BuildTask.targets index f5c12d0a3ec..aeb8eda2676 100644 --- a/eng/BuildTask.targets +++ b/eng/BuildTask.targets @@ -10,6 +10,8 @@ tools net $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackage + + $(BeforePack);Publish - - From 9db4805e00c91eebd2b240c2a87436d9e525d8b1 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 16:14:15 +0100 Subject: [PATCH 09/12] Run a few tests on Windows only and remove NS1x workarounds --- .../Microsoft.DotNet.Build.Tasks.Feed.Tests.csproj | 5 ----- ...Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj | 1 + .../OptProf/GenerateTrainingInputFilesTests.cs | 2 +- .../OptProf/GetRunSettingsSessionConfigurationTests.cs | 4 ++-- .../Microsoft.DotNet.Internal.SymbolHelper.csproj | 8 -------- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed.Tests/Microsoft.DotNet.Build.Tasks.Feed.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.Feed.Tests/Microsoft.DotNet.Build.Tasks.Feed.Tests.csproj index 7b091823dbe..023dbf32fc8 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed.Tests/Microsoft.DotNet.Build.Tasks.Feed.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Feed.Tests/Microsoft.DotNet.Build.Tasks.Feed.Tests.csproj @@ -21,11 +21,6 @@ - - - - - diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj index a4898226b76..89de808d16b 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs index 3b001e11895..218a83a1dfc 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs @@ -130,7 +130,7 @@ private static void CreateVsix(string vsixPath, string manifestContent) } } - [Fact] + [WindowsOnlyFact] public void Execute() { var temp = Path.GetTempPath(); diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs index b042f2e5840..868e9f59bce 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs @@ -409,7 +409,7 @@ public static void TestsIncorrectJsonFiles(string jsonString) Assert.Throws(() => GetRunSettingsSessionConfiguration.GetTestsDropName(jsonString)); } - [Fact] + [WindowsOnlyFact] public void Execute() { var temp = Path.GetTempPath(); @@ -446,7 +446,7 @@ public void Execute() Directory.Delete(dir, recursive: true); } - [Theory] + [WindowsOnlyTheory] [InlineData(products_only, products_only_expectedContainerString, products_only_expectedTestCaseFilterString)] [InlineData(assemblies_only, assemblies_only_expectedContainerString, assemblies_only_expectedTestCaseFilterString)] [InlineData(products_and_assemblies, products_and_assemblies_expectedContainerString, products_and_assemblies_expectedTestCaseFilterString)] diff --git a/src/Microsoft.DotNet.Internal.SymbolHelper/Microsoft.DotNet.Internal.SymbolHelper.csproj b/src/Microsoft.DotNet.Internal.SymbolHelper/Microsoft.DotNet.Internal.SymbolHelper.csproj index 9b2bc487369..5fcf7c75b03 100644 --- a/src/Microsoft.DotNet.Internal.SymbolHelper/Microsoft.DotNet.Internal.SymbolHelper.csproj +++ b/src/Microsoft.DotNet.Internal.SymbolHelper/Microsoft.DotNet.Internal.SymbolHelper.csproj @@ -7,14 +7,6 @@ - - - From 8d4f93c616549acd902798e36ef37d45fd6dfd16 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 16 Dec 2025 22:18:34 +0100 Subject: [PATCH 10/12] Delete VsixVerifier in SignCheck --- .../SignatureVerificationManager.cs | 1 - .../Verification/VsixVerifier.cs | 183 ------------------ 2 files changed, 184 deletions(-) delete mode 100644 src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs b/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs index 532fb245e85..47af1c34bb4 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs @@ -97,7 +97,6 @@ public SignatureVerificationManager(Exclusions exclusions, Log log, SignatureVer AddFileVerifier(new MsiVerifier(log, exclusions, options)); AddFileVerifier(new MspVerifier(log, exclusions, options)); AddFileVerifier(new MsuVerifier(log, exclusions, options)); - AddFileVerifier(new VsixVerifier(log, exclusions, options)); } AddFileVerifier(new DebVerifier(log, exclusions, options)); diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs b/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs deleted file mode 100644 index 5d8c2ebc84a..00000000000 --- a/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.IO; -using System.IO.Packaging; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Xml; -using Microsoft.SignCheck.Interop; -using Microsoft.SignCheck.Logging; - -namespace Microsoft.SignCheck.Verification -{ - public class VsixVerifier : ZipVerifier - { - public VsixVerifier(Log log, Exclusions exclusions, SignatureVerificationOptions options) : base(log, exclusions, options, fileExtension: ".vsix") - { - - } - - public override SignatureVerificationResult VerifySignature(string path, string parent, string virtualPath) - => VerifySupportedFileType(path, parent, virtualPath); - - // private bool TryGetTimestamp(PackageDigitalSignature packageSignature, out Timestamp timestamp) - // { - // bool isValidTimestampSignature = false; - - // if (packageSignature == null) - // { - // throw new ArgumentNullException(nameof(packageSignature)); - // } - - // timestamp = new Timestamp() - // { - // SignedOn = DateTime.MaxValue - // }; - - // XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable()); - // namespaceManager.AddNamespace("ds", "http://schemas.openxmlformats.org/package/2006/digital-signature"); - - // // Obtain timestamp from Signature Xml if there is one. - // XmlElement element = packageSignature.Signature.GetXml(); - // XmlNode encodedTimeNode = element.SelectNodes("//ds:TimeStamp/ds:EncodedTime", namespaceManager).OfType().FirstOrDefault(); - - // // If timestamp found, verify it. - // if (encodedTimeNode != null && encodedTimeNode.InnerText != null) - // { - // byte[] binaryTimestamp = null; - - // try - // { - // binaryTimestamp = Convert.FromBase64String(encodedTimeNode.InnerText); - // } - // catch (FormatException) - // { - // return false; - // } - - // IntPtr TSContextPtr = IntPtr.Zero; - // IntPtr TSSignerPtr = IntPtr.Zero; - // IntPtr StoreHandle = IntPtr.Zero; - - // // Ensure timestamp corresponds to package signature - // isValidTimestampSignature = WinCrypt.CryptVerifyTimeStampSignature(binaryTimestamp, - // (uint)binaryTimestamp.Length, - // packageSignature.SignatureValue, - // (uint)packageSignature.SignatureValue.Length, - // IntPtr.Zero, - // out TSContextPtr, - // out TSSignerPtr, - // out StoreHandle); - - // if (isValidTimestampSignature) - // { - // var timestampContext = (CRYPT_TIMESTAMP_CONTEXT)Marshal.PtrToStructure(TSContextPtr, typeof(CRYPT_TIMESTAMP_CONTEXT)); - // var timestampInfo = (CRYPT_TIMESTAMP_INFO)Marshal.PtrToStructure(timestampContext.pTimeStamp, typeof(CRYPT_TIMESTAMP_INFO)); - - // unchecked - // { - // uint low = (uint)timestampInfo.ftTime.dwLowDateTime; - // long ftTimestamp = (((long)timestampInfo.ftTime.dwHighDateTime) << 32) | low; - - // timestamp.SignedOn = DateTime.FromFileTime(ftTimestamp); - // } - - // // Get the algorithm name based on the OID. - // timestamp.SignatureAlgorithm = Oid.FromOidValue(timestampInfo.HashAlgorithm.pszObjId, OidGroup.HashAlgorithm).FriendlyName; - - // X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); - // timestamp.EffectiveDate = certificate.NotBefore; - // timestamp.ExpiryDate = certificate.NotAfter; - // } - - // if (IntPtr.Zero != TSContextPtr) - // { - // WinCrypt.CryptMemFree(TSContextPtr); - // } - // if (IntPtr.Zero != TSSignerPtr) - // { - // WinCrypt.CertFreeCertificateContext(TSSignerPtr); - // } - // if (IntPtr.Zero != StoreHandle) - // { - // WinCrypt.CertCloseStore(StoreHandle, 0); - // } - // } - - // return isValidTimestampSignature; - // } - - protected override bool IsSigned(string path, SignatureVerificationResult result) - { - // TODO: Fix this - throw new NotImplementedException(); - - // PackageDigitalSignature packageSignature = null; - - // using (var vsixStream = new FileStream(path, FileMode.Open, FileAccess.Read)) - // { - // var vsixPackage = Package.Open(vsixStream); - // var signatureManager = new PackageDigitalSignatureManager(vsixPackage); - - // if (!signatureManager.IsSigned) - // { - // return false; - // } - - // if (signatureManager.Signatures.Count() != 1) - // { - // return false; - // } - - // if (signatureManager.Signatures[0].SignedParts.Count != vsixPackage.GetParts().Count() - 1) - // { - // return false; - // } - - // packageSignature = signatureManager.Signatures[0]; - - // // Retrieve the timestamp - // Timestamp timestamp; - // if (!TryGetTimestamp(packageSignature, out timestamp)) - // { - // // Timestamp is either invalid or not present - // result.AddDetail(DetailKeys.Error, SignCheckResources.ErrorInvalidOrMissingTimestamp); - // return false; - // } - - // // Update the result with the timestamp detail - // result.AddDetail(DetailKeys.Signature, String.Format(SignCheckResources.DetailTimestamp, timestamp.SignedOn, timestamp.SignatureAlgorithm)); - - // // Verify the certificate chain - // X509Certificate2 certificate = new X509Certificate2(packageSignature.Signer); - - // X509Chain certChain = new X509Chain(); - // certChain.ChainPolicy.RevocationFlag = X509RevocationFlag.ExcludeRoot; - // certChain.ChainPolicy.RevocationMode = X509RevocationMode.Online; - - // // If the certificate has expired, but the VSIX was signed prior to expiration - // // we can ignore invalid time policies. - // bool certExpired = DateTime.Now > certificate.NotAfter; - - // if (timestamp.IsValid && certExpired) - // { - // certChain.ChainPolicy.VerificationFlags |= X509VerificationFlags.IgnoreNotTimeValid; - // } - - // if (!certChain.Build(certificate)) - // { - // result.AddDetail(DetailKeys.Error, SignCheckResources.DetailErrorFailedToBuildCertChain); - // return false; - // } - - // result.AddDetail(DetailKeys.Misc, SignCheckResources.DetailCertChainValid); - // } - - // return true; - } - } -} From 968497d7dcd6e087c8822b3b5674625fc360fe82 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 18 Dec 2025 18:03:04 +0100 Subject: [PATCH 11/12] Make tests robust --- ...rosoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj | 1 - .../OptProf/GenerateTrainingInputFilesTests.cs | 10 +++++----- .../OptProf/GetRunSettingsSessionConfigurationTests.cs | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj index 89de808d16b..a4898226b76 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj @@ -7,7 +7,6 @@ - diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs index 218a83a1dfc..25102894143 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs @@ -130,7 +130,7 @@ private static void CreateVsix(string vsixPath, string manifestContent) } } - [WindowsOnlyFact] + [Fact] public void Execute() { var temp = Path.GetTempPath(); @@ -182,7 +182,7 @@ public void Execute() ""RelativeInstallationPath"": ""Common7\\IDE\\PrivateAssemblies\\System.Collections.Immutable.dll"", ""InstrumentationArguments"": ""/ExeConfig:\""%VisualStudio.InstallationUnderTest.Path%\\Common7\\IDE\\vsn.exe\"""" } -", json); +", json, ignoreLineEndingDifferences: true); JObject.Parse(json); @@ -193,7 +193,7 @@ public void Execute() ""RelativeInstallationPath"": ""MSBuild\\15.0\\Bin\\Roslyn\\System.Collections.Immutable.dll"", ""InstrumentationArguments"": ""/ExeConfig:\""%VisualStudio.InstallationUnderTest.Path%\\Common7\\IDE\\zzz.exe\"""" } -", json); +", json, ignoreLineEndingDifferences: true); JObject.Parse(json); @@ -204,7 +204,7 @@ public void Execute() ""RelativeInstallationPath"": ""Common7\\IDE\\CommonExtensions\\Microsoft\\ManagedLanguages\\VBCSharp\\LanguageServices\\x\\y\\z\\Microsoft.CodeAnalysis.CSharp.dll"", ""InstrumentationArguments"": ""/ExeConfig:\""%VisualStudio.InstallationUnderTest.Path%\\Common7\\IDE\\vsn.exe\"""" } -", json); +", json, ignoreLineEndingDifferences: true); JObject.Parse(json); json = File.ReadAllText(Path.Combine(outputDir, @"TeamEng\Configurations\TeamEng.OptProfTest.vs_debugger_start_no_build_cs_scribble\xyzMicrosoft.CodeAnalysis.VisualBasic.0.IBC.json")); @@ -214,7 +214,7 @@ public void Execute() ""RelativeInstallationPath"": ""Common7\\IDE\\CommonExtensions\\Microsoft\\ManagedLanguages\\VBCSharp\\LanguageServices\\x\\y\\z\\Microsoft.CodeAnalysis.VisualBasic.dll"", ""InstrumentationArguments"": ""/ExeConfig:\""%VisualStudio.InstallationUnderTest.Path%\\Common7\\IDE\\vsn.exe\"""" } -", json); +", json, ignoreLineEndingDifferences: true); JObject.Parse(json); Assert.True(result); diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs index 868e9f59bce..6e28e615327 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs @@ -409,7 +409,7 @@ public static void TestsIncorrectJsonFiles(string jsonString) Assert.Throws(() => GetRunSettingsSessionConfiguration.GetTestsDropName(jsonString)); } - [WindowsOnlyFact] + [Fact] public void Execute() { var temp = Path.GetTempPath(); @@ -439,14 +439,14 @@ public void Execute() -FullyQualifiedName=DDRIT.RPS.CSharp.CSharpTest.EditingAndDesigner|FullyQualifiedName=VSPE.OptProfTests.vs_perf_designtime_ide_searchtest|FullyQualifiedName=VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs|FullyQualifiedName=VSPE.OptProfTests.vs_asl_cs_scenario|FullyQualifiedName=VSPE.OptProfTests.vs_ddbvtqa_vbwi|FullyQualifiedName=VSPE.OptProfTests.vs_asl_vb_scenario|FullyQualifiedName=VSPE.OptProfTests.vs_env_solution_createnewproject_vb_winformsapp|FullyQualifiedName=DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging", task.SessionConfiguration); +FullyQualifiedName=DDRIT.RPS.CSharp.CSharpTest.EditingAndDesigner|FullyQualifiedName=VSPE.OptProfTests.vs_perf_designtime_ide_searchtest|FullyQualifiedName=VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs|FullyQualifiedName=VSPE.OptProfTests.vs_asl_cs_scenario|FullyQualifiedName=VSPE.OptProfTests.vs_ddbvtqa_vbwi|FullyQualifiedName=VSPE.OptProfTests.vs_asl_vb_scenario|FullyQualifiedName=VSPE.OptProfTests.vs_env_solution_createnewproject_vb_winformsapp|FullyQualifiedName=DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging", task.SessionConfiguration, ignoreLineEndingDifferences: true); Assert.True(result); Directory.Delete(dir, recursive: true); } - [WindowsOnlyTheory] + [Theory] [InlineData(products_only, products_only_expectedContainerString, products_only_expectedTestCaseFilterString)] [InlineData(assemblies_only, assemblies_only_expectedContainerString, assemblies_only_expectedTestCaseFilterString)] [InlineData(products_and_assemblies, products_and_assemblies_expectedContainerString, products_and_assemblies_expectedTestCaseFilterString)] @@ -454,8 +454,8 @@ public void Execute() public void TestProductsOnly(string configJson, string expectedContainerString, string expectedTestCaseFilterString) { var (actualContainerString, actualTestCaseFilterString) = GetRunSettingsSessionConfiguration.GetTestContainersAndFilters(configJson, "config.json"); - Assert.Equal(expectedContainerString, actualContainerString); - Assert.Equal(expectedTestCaseFilterString, actualTestCaseFilterString); + Assert.Equal(expectedContainerString, actualContainerString, ignoreLineEndingDifferences: true); + Assert.Equal(expectedTestCaseFilterString, actualTestCaseFilterString, ignoreLineEndingDifferences: true); } } } From 799c81375ef5adfc2d2e47e7309fe2f6860c2997 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 18 Dec 2025 20:11:13 +0100 Subject: [PATCH 12/12] Fix one test to not run non Windows --- .../Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj | 1 + .../OptProf/GenerateTrainingInputFilesTests.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj index a4898226b76..89de808d16b 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs index 25102894143..483994409c2 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GenerateTrainingInputFilesTests.cs @@ -130,7 +130,7 @@ private static void CreateVsix(string vsixPath, string manifestContent) } } - [Fact] + [WindowsOnlyFact] public void Execute() { var temp = Path.GetTempPath();