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/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.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..aeb8eda2676 100644 --- a/eng/BuildTask.targets +++ b/eng/BuildTask.targets @@ -1,7 +1,5 @@ - - false true @@ -10,8 +8,10 @@ true tools - true - $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore;_AddBuildOutputToPackageDesktop + net + $(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackage + + $(BeforePack);Publish - + @@ -55,24 +55,6 @@ - - - - - - - - - - - - - - - - - - - - - - - net - + + - - - - 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) - - + net472 @@ -34,7 +34,7 @@ - + @@ -45,24 +45,23 @@ - - - - - - - - - - - + + + + + + + + + + - + @@ -97,10 +96,10 @@ - + 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.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.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.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..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 @@ -1,12 +1,13 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) + 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..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(); @@ -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 b042f2e5840..6e28e615327 100644 --- a/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs +++ b/src/Microsoft.DotNet.Build.Tasks.VisualStudio.Tests/OptProf/GetRunSettingsSessionConfigurationTests.cs @@ -439,7 +439,7 @@ 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); @@ -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); } } } 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..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 @@ -1,7 +1,7 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) true true Arcade SDK build tasks for Visual Studio profile guided optimization training @@ -12,9 +12,7 @@ - - - + 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..c96e5c37b26 100644 --- a/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs +++ b/src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs @@ -6,9 +6,7 @@ using System; using System.IO; using System.Reflection; -#if NETCOREAPP using System.Runtime.Loader; -#endif namespace Microsoft.DotNet.Build.Tasks { @@ -19,40 +17,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..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,17 +17,8 @@ - - - - - - - - - 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..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,15 +18,8 @@ - - - - - - - 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..da6a1dffb04 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.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 @@ - - - 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..6b84b7fe0a0 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 - - - - @@ -28,11 +24,7 @@ - - - - - + 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..85aeb7fcb2e 100644 --- a/src/Microsoft.DotNet.SignTool/src/ZipData.cs +++ b/src/Microsoft.DotNet.SignTool/src/ZipData.cs @@ -8,18 +8,14 @@ using System.Collections.Immutable; using System.IO; using System.IO.Compression; +using System.IO.Packaging; using System.Linq; using System.Data; using System.Diagnostics; 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 +50,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 +66,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 +86,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 +106,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 +123,6 @@ public void Repack(TaskLoggingHelper log, string tempDir, string wix3ToolsPath, } } -#if NET472 /// /// Repack a zip container with a package structure. /// @@ -191,7 +162,6 @@ string getPartRelativeFileName(PackagePart part) } } } -#endif private static IEnumerable ReadZipEntries(string archivePath) { @@ -353,9 +323,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 +368,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 +728,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..1f75fc74ac8 100644 --- a/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj +++ b/src/Microsoft.DotNet.StrongName/Microsoft.DotNet.StrongName.csproj @@ -1,8 +1,7 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) - Library + $(NetToolCurrent) true true true @@ -10,20 +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..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 @@ -1,11 +1,12 @@ - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true true This package provides support for generating client library code from a swagger document. true + true @@ -13,8 +14,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 - - - - - - - + + + + + + + false - true true + + + + - @@ -38,43 +40,6 @@ CopyToOutputDirectory="PreserveNewest" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /// Generate a hash for a string value using a given hash algorithm. /// @@ -191,7 +188,6 @@ public static (int exitCode, string output, string error) RunBashCommand(string } } -#if NET /// /// Download the Microsoft and Azure Linux public keys and import them into the keyring. /// @@ -239,7 +235,6 @@ public static TarEntry TryGetNextTarEntry(this TarReader reader) return null; } } -#endif /// /// Parses a code signing timestamp string into a DateTime object. diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCode.cs b/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCode.cs index 05a94a8ca89..3fef8aaed06 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCode.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCode.cs @@ -22,103 +22,6 @@ public static bool IsSigned(string path, SignatureVerificationResult svr, ISecur public static IEnumerable GetTimestamps(string path, ISecurityInfoProvider securityInfoProvider) => string.IsNullOrEmpty(path) ? Enumerable.Empty() : GetTimestampsInternal(path, securityInfoProvider); -#if NETFRAMEWORK - private static bool IsSignedInternal(string path, SignatureVerificationResult svr, ISecurityInfoProvider securityInfoProvider) - { - WinTrustFileInfo fileInfo = new WinTrustFileInfo() - { - cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustFileInfo)), - pcwszFilePath = Path.GetFullPath(path), - hFile = IntPtr.Zero, - pgKnownSubject = IntPtr.Zero - }; - - WinTrustData data = new WinTrustData() - { - cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustData)), - dwProvFlags = 0, - dwStateAction = Convert.ToUInt32(StateAction.WTD_STATEACTION_IGNORE), - dwUIChoice = Convert.ToUInt32(UIChoice.WTD_UI_NONE), - dwUIContext = 0, - dwUnionChoice = Convert.ToUInt32(UnionChoice.WTD_CHOICE_FILE), - fdwRevocationChecks = Convert.ToUInt32(RevocationChecks.WTD_REVOKE_NONE), - hWVTStateData = IntPtr.Zero, - pFile = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WinTrustFileInfo))), - pPolicyCallbackData = IntPtr.Zero, - pSIPClientData = IntPtr.Zero, - pwszURLReference = IntPtr.Zero - }; - - // Potential memory leak. Need to investigate - Marshal.StructureToPtr(fileInfo, data.pFile, false); - - IntPtr pGuid = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))); - IntPtr pData = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WinTrustData))); - Marshal.StructureToPtr(data, pData, true); - Marshal.StructureToPtr(WinTrust.WINTRUST_ACTION_GENERIC_VERIFY_V2, pGuid, true); - - uint hrresult = WinTrust.WinVerifyTrust(IntPtr.Zero, pGuid, pData); - - Marshal.FreeHGlobal(pGuid); - Marshal.FreeHGlobal(pData); - - // Log non-zero HRESULTs - if (hrresult != 0) - { - string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message; - svr.AddDetail(DetailKeys.Error, String.Format(SignCheckResources.ErrorHResult, hrresult, errorMessage)); - } - - return hrresult == 0; - } - - private static IEnumerable GetTimestampsInternal(string path, ISecurityInfoProvider securityInfoProvider) - { - int msgAndCertEncodingType; - int msgContentType; - int formatType; - - // NULL indicates that information is unneeded - IntPtr certStore = IntPtr.Zero; - IntPtr msg = IntPtr.Zero; - IntPtr context = IntPtr.Zero; - - if (!WinCrypt.CryptQueryObject( - WinCrypt.CERT_QUERY_OBJECT_FILE, - Marshal.StringToHGlobalUni(path), - WinCrypt.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | WinCrypt.CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | WinCrypt.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED, - WinCrypt.CERT_QUERY_FORMAT_FLAG_ALL, - 0, - out msgAndCertEncodingType, - out msgContentType, - out formatType, - ref certStore, - ref msg, - ref context)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - int cbData = 0; - - // Passing in NULL to pvData retrieves the size of the encoded message - if (!WinCrypt.CryptMsgGetParam(msg, WinCrypt.CMSG_ENCODED_MESSAGE, 0, IntPtr.Zero, ref cbData)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - byte[] vData = new byte[cbData]; - if (!WinCrypt.CryptMsgGetParam(msg, WinCrypt.CMSG_ENCODED_MESSAGE, 0, vData, ref cbData)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - var signedCms = new SignedCms(); - signedCms.Decode(vData); - - return ExtractTimestamps(signedCms); - } -#else private static bool IsSignedInternal(string path, SignatureVerificationResult svr, ISecurityInfoProvider securityInfoProvider) { if (securityInfoProvider == null) @@ -181,7 +84,6 @@ private static SignerInfo GetPrimarySignerInfo(SignerInfoCollection signerInfos) return signerInfos[0]; } -#endif private static IEnumerable ExtractTimestamps(SignedCms signedCms) { diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCodeVerifier.cs b/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCodeVerifier.cs index 83bc68bdf90..76c70060fa4 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCodeVerifier.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/AuthentiCodeVerifier.cs @@ -9,9 +9,7 @@ using System.Security.Cryptography; using System.Security.Cryptography.Pkcs; using Microsoft.SignCheck.Logging; -#if NET using System.Reflection.PortableExecutable; -#endif namespace Microsoft.SignCheck.Verification { @@ -90,7 +88,6 @@ public class AuthentiCodeSecurityInfoProvider : ISecurityInfoProvider { public SignedCms ReadSecurityInfo(string path) { -#if NET using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) using (PEReader peReader = new PEReader(fs)) { @@ -123,10 +120,8 @@ public SignedCms ReadSecurityInfo(string path) return signedCms; } } + return null; -#else - throw new NotSupportedException("Not supported on .NET Framework"); -#endif } } } diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/ExeVerifier.cs b/src/SignCheck/Microsoft.SignCheck/Verification/ExeVerifier.cs index 8059917efac..6444c37e96e 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/ExeVerifier.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/ExeVerifier.cs @@ -5,9 +5,7 @@ using System.IO; using System.Linq; using Microsoft.SignCheck.Logging; -#if NETFRAMEWORK using Microsoft.Tools.WindowsInstallerXml; -#endif namespace Microsoft.SignCheck.Verification { @@ -26,7 +24,6 @@ public override SignatureVerificationResult VerifySignature(string path, string if (VerifyRecursive) { -#if NETFRAMEWORK if (PEHeader.ImageSectionHeaders.Select(s => s.SectionName).Contains(".wixburn")) { Log.WriteMessage(LogVerbosity.Diagnostic, SignCheckResources.DiagSectionHeader, ".wixburn"); @@ -57,9 +54,6 @@ public override SignatureVerificationResult VerifySignature(string path, string unbinder.DeleteTempFiles(); } } -#else - Log.WriteMessage(LogVerbosity.Normal, $"Unable to verify contents of '{svr.FullPath}' on .NET Core."); -#endif } // TODO: Check for SFXCAB, IronMan, etc. @@ -70,11 +64,9 @@ public override SignatureVerificationResult VerifySignature(string path, string /// /// Event handler for WiX Burn to extract a bundle. /// -#if NETFRAMEWORK private void UnbinderEventHandler(object sender, MessageEventArgs e) { Log.WriteMessage(LogVerbosity.Detailed, String.Format("{0}|{1}|{2}|{3}", e.Id, e.Level, e.ResourceName, e.SourceLineNumbers)); } -#endif } } diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/LZMAUtils.cs b/src/SignCheck/Microsoft.SignCheck/Verification/LZMAUtils.cs index ca64cb8afff..2ede504db04 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/LZMAUtils.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/LZMAUtils.cs @@ -40,25 +40,9 @@ public static void Decompress(string sourceFile, string destinationFile) } } -#if NET private static void ReadExactly(FileStream stream, byte[] buffer, int offset, int count) { stream.ReadExactly(buffer, offset, count); } -#else - private static void ReadExactly(FileStream stream, byte[] buffer, int offset, int count) - { - while (count > 0) - { - int read = stream.Read(buffer, offset, count); - if (read <= 0) - { - throw new EndOfStreamException(); - } - offset += read; - count -= read; - } - } -#endif } } diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs b/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs index 1fbec04b00d..47af1c34bb4 100644 --- a/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs +++ b/src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationManager.cs @@ -86,18 +86,19 @@ public SignatureVerificationManager(Exclusions exclusions, Log log, SignatureVer Log = log; Options = options; -#if NETFRAMEWORK - AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".psd1")); - AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".psm1")); - AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".ps1")); - AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".ps1xml")); - AddFileVerifier(new CabVerifier(log, exclusions, options, ".cab")); - AddFileVerifier(new JarVerifier(log, exclusions, options)); - AddFileVerifier(new MsiVerifier(log, exclusions, options)); - AddFileVerifier(new MspVerifier(log, exclusions, options)); - AddFileVerifier(new MsuVerifier(log, exclusions, options)); - AddFileVerifier(new VsixVerifier(log, exclusions, options)); -#else + if (OperatingSystem.IsWindows()) + { + AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".psd1")); + AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".psm1")); + AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".ps1")); + AddFileVerifier(new AuthentiCodeVerifier(log, exclusions, options, ".ps1xml")); + AddFileVerifier(new CabVerifier(log, exclusions, options, ".cab")); + AddFileVerifier(new JarVerifier(log, exclusions, options)); + AddFileVerifier(new MsiVerifier(log, exclusions, options)); + AddFileVerifier(new MspVerifier(log, exclusions, options)); + AddFileVerifier(new MsuVerifier(log, exclusions, options)); + } + AddFileVerifier(new DebVerifier(log, exclusions, options)); AddFileVerifier(new MachOVerifier(log, exclusions, options, ".dylib")); AddFileVerifier(new MachOVerifier(log, exclusions, options, ".macho")); @@ -109,7 +110,6 @@ public SignatureVerificationManager(Exclusions exclusions, Log log, SignatureVer AddFileVerifier(new TarVerifier(log, exclusions, options, ".tgz")); AddFileVerifier(new TarVerifier(log, exclusions, options, ".gz")); AddFileVerifier(new RpmVerifier(log, exclusions, options)); -#endif AddFileVerifier(new ExeVerifier(log, exclusions, options, ".exe")); AddFileVerifier(new JavaScriptVerifier(log, exclusions, options)); AddFileVerifier(new LzmaVerifier(log, exclusions, options)); @@ -276,7 +276,7 @@ public static FileVerifier GetFileVerifierByHeader(string path) fileVerifier = GetFileVerifierByExtension(".macho"); } } -#if NETFRAMEWORK + reader.BaseStream.Seek(0, SeekOrigin.Begin); if (stream.Length > 2) { @@ -295,7 +295,6 @@ public static FileVerifier GetFileVerifierByHeader(string path) } } } -#endif } return fileVerifier; diff --git a/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs b/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs deleted file mode 100644 index 4b9b11c9400..00000000000 --- a/src/SignCheck/Microsoft.SignCheck/Verification/VsixVerifier.cs +++ /dev/null @@ -1,180 +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) - { - 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..932757f9442 100644 --- a/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj +++ b/src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj @@ -3,31 +3,21 @@ - $(NetFrameworkToolCurrent) + $(NetToolCurrent) Exe - true false true - - true Build artifact signing validation tool Arcade Signing Validation Tool SignCheck + true + signcheck + true - + - - - - - - - - diff --git a/src/SignCheck/SignCheckTask/Microsoft.DotNet.SignCheckTask.csproj b/src/SignCheck/SignCheckTask/Microsoft.DotNet.SignCheckTask.csproj index ede49db7e8c..6d7c7747662 100644 --- a/src/SignCheck/SignCheckTask/Microsoft.DotNet.SignCheckTask.csproj +++ b/src/SignCheck/SignCheckTask/Microsoft.DotNet.SignCheckTask.csproj @@ -1,7 +1,7 @@  - $(NetToolCurrent);$(NetFrameworkToolCurrent) + $(NetToolCurrent) true false true @@ -21,11 +21,6 @@ - - - - - - $(MSBuildThisFileDirectory)..\lib\net\Microsoft.DotNet.SignCheckTask.dll - $(MSBuildThisFileDirectory)..\lib\netframework\Microsoft.DotNet.SignCheckTask.dll + $(MSBuildThisFileDirectory)..\lib\net\Microsoft.DotNet.SignCheckTask.dll - + diff --git a/src/SignCheck/SignCheckTask/src/SignCheckTask.cs b/src/SignCheck/SignCheckTask/src/SignCheckTask.cs index 63cdd484c7a..84df0910bdc 100644 --- a/src/SignCheck/SignCheckTask/src/SignCheckTask.cs +++ b/src/SignCheck/SignCheckTask/src/SignCheckTask.cs @@ -3,11 +3,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -#if NET472 -using AppDomainIsolatedTask = Microsoft.Build.Utilities.AppDomainIsolatedTask; -#else using BuildTask = Microsoft.Build.Utilities.Task; -#endif using Microsoft.SignCheck.Logging; using System; using System.Collections.Generic; @@ -16,16 +12,8 @@ namespace SignCheckTask { -#if NETFRAMEWORK - [LoadInSeparateAppDomain] - [RunInSTA] - public class SignCheckTask : AppDomainIsolatedTask - { - static SignCheckTask() => Microsoft.DotNet.AssemblyResolution.Initialize(); -#else public class SignCheckTask : BuildTask { -#endif public bool EnableJarSignatureVerification { get; @@ -104,9 +92,6 @@ public string ArtifactFolder public override bool Execute() { -#if NETFRAMEWORK - Microsoft.DotNet.AssemblyResolution.Log = Log; -#endif try { bool succeeded = ExecuteImpl(); @@ -114,9 +99,6 @@ public override bool Execute() } finally { -#if NETFRAMEWORK - Microsoft.DotNet.AssemblyResolution.Log = null; -#endif } } 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) - - - - - - - - - - - - - - diff --git a/tests/UnitTests.proj b/tests/UnitTests.proj index baaa1b68e4f..d7a8da363a0 100644 --- a/tests/UnitTests.proj +++ b/tests/UnitTests.proj @@ -2,9 +2,9 @@ + - $(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