diff --git a/src/Build.OM.UnitTests/Microsoft.Build.Engine.OM.UnitTests.csproj b/src/Build.OM.UnitTests/Microsoft.Build.Engine.OM.UnitTests.csproj index 9acc79843a2..c50c47b3047 100644 --- a/src/Build.OM.UnitTests/Microsoft.Build.Engine.OM.UnitTests.csproj +++ b/src/Build.OM.UnitTests/Microsoft.Build.Engine.OM.UnitTests.csproj @@ -1,7 +1,5 @@  - - $(RuntimeOutputTargetFrameworks) $(RuntimeOutputPlatformTarget) @@ -9,8 +7,6 @@ Microsoft.Build.Engine.OM.UnitTests true - - $(DefineConstants);MICROSOFT_BUILD_ENGINE_OM_UNITTESTS;NO_FRAMEWORK_IVT @@ -36,15 +32,6 @@ GlobalUsings.cs - - EncodingStringWriter.cs - - - - - - BuildEnvironmentHelper.cs - App.config Designer @@ -61,7 +48,7 @@ - + diff --git a/src/Build.UnitTests/BackEnd/SdkResolverLoader_Tests.cs b/src/Build.UnitTests/BackEnd/SdkResolverLoader_Tests.cs index 18c88d259dc..b310fa1bd2a 100644 --- a/src/Build.UnitTests/BackEnd/SdkResolverLoader_Tests.cs +++ b/src/Build.UnitTests/BackEnd/SdkResolverLoader_Tests.cs @@ -426,12 +426,7 @@ public void LoadResolverAssembly_MSBuildSdkResolver_WithAndWithoutFallback(bool if (string.IsNullOrEmpty(msBuildExePath)) { // Use the executing assembly path as fallback - msBuildExePath = BuildEnvironmentHelper.ExecutingAssemblyPath; - // If that's also null/empty, use test assembly location - if (string.IsNullOrEmpty(msBuildExePath)) - { - msBuildExePath = typeof(BuildEnvironmentHelper).Assembly.Location; - } + msBuildExePath = Path.GetFullPath(Assembly.GetExecutingAssembly().Location); } BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly( diff --git a/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs b/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs index d52d5f72651..937f9ebf042 100644 --- a/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs +++ b/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs @@ -18,7 +18,7 @@ public class BuildEnvironmentHelper_Tests [Fact] public void GetExecutablePath() { - var msbuildPath = Path.GetDirectoryName(BuildEnvironmentHelper.ExecutingAssemblyPath); + var msbuildPath = Path.GetDirectoryName(typeof(BuildEnvironmentHelper).GetAssemblyPath()); string expectedMSBuildPath = Path.Combine(msbuildPath, Constants.MSBuildExecutableName).ToLowerInvariant(); string configFilePath = BuildEnvironmentHelper.Instance.CurrentMSBuildConfigurationFile.ToLowerInvariant(); diff --git a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj index 3ff0799db7e..39c496de0b3 100644 --- a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj +++ b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj @@ -67,23 +67,18 @@ - XmakeAttributes_Tests.cs - AssemblyNameEx_Tests.cs TaskParameter_Tests.cs - - Collections\CopyOnWriteDictionary_Tests.cs - diff --git a/src/Shared/UnitTests/XmlUtilities_Tests.cs b/src/Build.UnitTests/XmlUtilities_Tests.cs similarity index 100% rename from src/Shared/UnitTests/XmlUtilities_Tests.cs rename to src/Build.UnitTests/XmlUtilities_Tests.cs diff --git a/src/Build/AssemblyInfo.cs b/src/Build/AssemblyInfo.cs index fd0a475c5e8..8cf576e4636 100644 --- a/src/Build/AssemblyInfo.cs +++ b/src/Build/AssemblyInfo.cs @@ -19,6 +19,7 @@ #endif [assembly: InternalsVisibleTo("Microsoft.Build.Framework.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] [assembly: InternalsVisibleTo("Microsoft.Build.Engine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] +[assembly: InternalsVisibleTo("Microsoft.Build.Engine.OM.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] [assembly: InternalsVisibleTo("Microsoft.Build.BuildCheck.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] [assembly: InternalsVisibleTo("Microsoft.Build.UnitTests.Shared, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] [assembly: InternalsVisibleTo("Microsoft.Build.UnitTests.Shared, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] diff --git a/src/Shared/IKeyed.cs b/src/Build/Collections/IKeyed.cs similarity index 100% rename from src/Shared/IKeyed.cs rename to src/Build/Collections/IKeyed.cs diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index e64a57a7627..cf120f7961a 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -492,7 +492,7 @@ public static Version Version // Use .CodeBase instead of .Location, because .Location doesn't // work when Microsoft.Build.dll has been shadow-copied, for example // in scenarios where NUnit is loading Microsoft.Build. - var versionInfo = FileVersionInfo.GetVersionInfo(BuildEnvironmentHelper.ExecutingAssemblyPath); + var versionInfo = FileVersionInfo.GetVersionInfo(typeof(ProjectCollection).GetAssemblyPath()); s_engineVersion = new Version(versionInfo.FileMajorPart, versionInfo.FileMinorPart, versionInfo.FileBuildPart, versionInfo.FilePrivatePart); } diff --git a/src/Shared/ToolsetElement.cs b/src/Build/Evaluation/ToolsetElement.cs similarity index 100% rename from src/Shared/ToolsetElement.cs rename to src/Build/Evaluation/ToolsetElement.cs diff --git a/src/Shared/IElementLocation.cs b/src/Build/IElementLocation.cs similarity index 56% rename from src/Shared/IElementLocation.cs rename to src/Build/IElementLocation.cs index 57fb254271c..5e0f60acc62 100644 --- a/src/Shared/IElementLocation.cs +++ b/src/Build/IElementLocation.cs @@ -3,9 +3,8 @@ using Microsoft.Build.BackEnd; -#nullable disable +namespace Microsoft.Build.Shared; -namespace Microsoft.Build.Shared +internal interface IElementLocation : IMSBuildElementLocation, ITranslatable { - internal interface IElementLocation : IMSBuildElementLocation, ITranslatable { } } diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj index 45f58aeba84..570acca3683 100644 --- a/src/Build/Microsoft.Build.csproj +++ b/src/Build/Microsoft.Build.csproj @@ -84,21 +84,6 @@ - - SharedUtilities\BuildEnvironmentHelper.cs - - - SharedUtilities\EncodingStringWriter.cs - - - SharedUtilities\AssemblyNameComparer.cs - - - SharedUtilities\AwaitExtensions - - - SharedUtilities\AssemblyNameReverseVersionComparer.cs - BackEnd\Components\RequestBuilder\IntrinsicTasks\CanonicalError.cs @@ -108,14 +93,6 @@ SharedUtilities\StringExtensions.cs - - SharedUtilities\StringUtils.cs - - - Collections\ReadOnlyEmptyCollection.cs - - - @@ -128,7 +105,6 @@ - @@ -139,11 +115,9 @@ - PlatformNegotiation.cs - BackEnd\Components\RequestBuilder\IntrinsicTasks\TaskLoggingHelper.cs @@ -152,11 +126,8 @@ - - - @@ -192,16 +163,19 @@ + + + @@ -209,6 +183,9 @@ + + + @@ -401,15 +378,11 @@ - - - Collections\CopyOnWriteDictionary.cs - @@ -423,7 +396,6 @@ - @@ -474,7 +446,6 @@ - @@ -555,7 +526,6 @@ - @@ -629,51 +599,16 @@ + - - SharedUtilities\AssemblyLoadInfo.cs - - - SharedUtilities\ReadOnlyEmptyDictionary.cs - - - SharedUtilities\AssemblyNameExtension.cs - SharedUtilities\BuildEventFileInfo.cs - - SharedUtilities\ConversionUtilities.cs - - - SharedUtilities\FileDelegates.cs - Errors\ErrorUtilities.cs - - SharedUtilities\VersionUtilities.cs - - - SharedUtilities\EventArgsFormatting.cs - - - SharedUtilities\FileMatcher.cs - - - SharedUtilities\FrameworkLocationHelper.cs - - - SharedUtilities\IElementLocation.cs - - - SharedUtilities\LoadedType.cs - - - SharedUtilities\TypeUtilities.cs - InprocTrackingNativeMethods.cs @@ -683,20 +618,13 @@ Errors\ProjectFileErrorUtilities.cs - - SharedUtilities\ProjectWriter.cs - SharedUtilities\ResourceUtilities.cs - SharedUtilities\TypeLoader.cs - - SharedUtilities\MSBuildLoadContext.cs - VisualStudioConstants.cs @@ -706,9 +634,6 @@ Resources\XMakeElements.cs - - SharedUtilities\XmlUtilities.cs - diff --git a/src/Shared/AwaitExtensions.cs b/src/Build/Utilities/AwaitExtensions.cs similarity index 100% rename from src/Shared/AwaitExtensions.cs rename to src/Build/Utilities/AwaitExtensions.cs diff --git a/src/Shared/EncodingStringWriter.cs b/src/Build/Utilities/EncodingStringWriter.cs similarity index 100% rename from src/Shared/EncodingStringWriter.cs rename to src/Build/Utilities/EncodingStringWriter.cs diff --git a/src/Shared/ProjectWriter.cs b/src/Build/Utilities/ProjectWriter.cs similarity index 100% rename from src/Shared/ProjectWriter.cs rename to src/Build/Utilities/ProjectWriter.cs diff --git a/src/Shared/XmlUtilities.cs b/src/Build/Utilities/XmlUtilities.cs similarity index 100% rename from src/Shared/XmlUtilities.cs rename to src/Build/Utilities/XmlUtilities.cs diff --git a/src/Shared/UnitTests/CopyOnWriteDictionary_Tests.cs b/src/Framework.UnitTests/CopyOnWriteDictionary_Tests.cs similarity index 100% rename from src/Shared/UnitTests/CopyOnWriteDictionary_Tests.cs rename to src/Framework.UnitTests/CopyOnWriteDictionary_Tests.cs diff --git a/src/Shared/UnitTests/FileMatcher_Tests.cs b/src/Framework.UnitTests/FileMatcher_Tests.cs similarity index 100% rename from src/Shared/UnitTests/FileMatcher_Tests.cs rename to src/Framework.UnitTests/FileMatcher_Tests.cs diff --git a/src/Framework.UnitTests/FileUtilities_Tests.cs b/src/Framework.UnitTests/FileUtilities_Tests.cs index 6e8965ade92..e75118ed373 100644 --- a/src/Framework.UnitTests/FileUtilities_Tests.cs +++ b/src/Framework.UnitTests/FileUtilities_Tests.cs @@ -938,8 +938,7 @@ public void RelativePathMaybeAdjustFilePathWithBaseDirectory() } } - private static string SystemSpecificAbsolutePath => BuildEnvironmentHelper.ExecutingAssemblyPath; - + private static string SystemSpecificAbsolutePath => typeof(BuildEnvironmentHelper).GetAssemblyPath(); [Fact] public void GetFolderAboveTest() diff --git a/src/Shared/BufferedReadStream.cs b/src/Framework/BackEnd/BufferedReadStream.cs similarity index 98% rename from src/Shared/BufferedReadStream.cs rename to src/Framework/BackEnd/BufferedReadStream.cs index 47c8a362f2c..1a2ed5ad7e7 100644 --- a/src/Shared/BufferedReadStream.cs +++ b/src/Framework/BackEnd/BufferedReadStream.cs @@ -5,11 +5,7 @@ using System.IO; using System.IO.Pipes; using System.Threading; - -#if NET451_OR_GREATER || NETCOREAPP using System.Threading.Tasks; -#endif - namespace Microsoft.Build.BackEnd { @@ -125,7 +121,6 @@ public override int Read(byte[] buffer, int offset, int count) } } -#if NET451_OR_GREATER || NETCOREAPP public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (count > BUFFER_SIZE) @@ -179,7 +174,6 @@ int CopyToBuffer(byte[] buffer, int offset) return alreadyCopied; } } -#endif public override long Seek(long offset, SeekOrigin origin) { diff --git a/src/Shared/InterningBinaryReader.cs b/src/Framework/BackEnd/InterningBinaryReader.cs similarity index 94% rename from src/Shared/InterningBinaryReader.cs rename to src/Framework/BackEnd/InterningBinaryReader.cs index 3ce9cf42c2b..ce7f6a4a348 100644 --- a/src/Shared/InterningBinaryReader.cs +++ b/src/Framework/BackEnd/InterningBinaryReader.cs @@ -7,8 +7,8 @@ using System.IO; using System.Text; using System.Threading; +using Microsoft.Build.Framework; using Microsoft.NET.StringTools; -using ErrorUtilities = Microsoft.Build.Shared.ErrorUtilities; #nullable disable @@ -118,7 +118,7 @@ public override String ReadString() // the actual error seems most likely to be occurring. if (n < 0) { - ErrorUtilities.ThrowInternalError("From calculating based on the memorystream, about to read n = {0}. length = {1}, rawPosition = {2}, readLength = {3}, stringLength = {4}, currPos = {5}.", n, length, rawPosition, readLength, stringLength, currPos); + FrameworkErrorUtilities.ThrowInternalError($"From calculating based on the memorystream, about to read n = {n}. length = {length}, rawPosition = {rawPosition}, readLength = {readLength}, stringLength = {stringLength}, currPos = {currPos}."); } memoryStream.Seek(n, SeekOrigin.Current); @@ -133,7 +133,7 @@ public override String ReadString() // See above explanation -- the OutOfRange exception may also be coming from our setting of n here ... if (n < 0) { - ErrorUtilities.ThrowInternalError("From getting the length out of BaseStream.Read directly, about to read n = {0}. readLength = {1}, stringLength = {2}, currPos = {3}", n, readLength, stringLength, currPos); + FrameworkErrorUtilities.ThrowInternalError($"From getting the length out of BaseStream.Read directly, about to read n = {n}. readLength = {readLength}, stringLength = {stringLength}, currPos = {currPos}"); } } diff --git a/src/Shared/TranslatorHelpers.cs b/src/Framework/BackEnd/TranslatorHelpers.cs similarity index 100% rename from src/Shared/TranslatorHelpers.cs rename to src/Framework/BackEnd/TranslatorHelpers.cs diff --git a/src/Shared/BuildEnvironmentHelper.cs b/src/Framework/BuildEnvironmentHelper.cs similarity index 95% rename from src/Shared/BuildEnvironmentHelper.cs rename to src/Framework/BuildEnvironmentHelper.cs index d6535d808a4..d8a9bfd9e2c 100644 --- a/src/Shared/BuildEnvironmentHelper.cs +++ b/src/Framework/BuildEnvironmentHelper.cs @@ -33,16 +33,6 @@ internal sealed class BuildEnvironmentHelper /// private static readonly string[] s_msBuildProcess = { "MSBUILD", "MSBUILDTASKHOST" }; - /// - /// Get the currently executing assembly path. - /// - /// - /// This property depends on BuildEnvironmentHelper being compiled into separate assemblies. - /// If BuildEnvironmentHelper is moved to a shared assembly, this property will need to be re-evaluated. - /// - internal static string ExecutingAssemblyPath - => Path.GetFullPath(AssemblyUtilities.GetAssemblyLocation(typeof(BuildEnvironmentHelper).Assembly)); - /// /// Gets the cached Build Environment instance. /// @@ -140,7 +130,7 @@ private static BuildEnvironment TryFromEnvironmentVariable() private static BuildEnvironment TryFromVisualStudioProcess() { - if (!NativeMethodsShared.IsWindows) + if (!NativeMethods.IsWindows) { return null; } @@ -172,7 +162,7 @@ private static BuildEnvironment TryFromMSBuildProcess() } // First check if we're in a VS installation - if (NativeMethodsShared.IsWindows && + if (NativeMethods.IsWindows && Regex.IsMatch(processName, $@".*\\MSBuild\\{CurrentToolsVersion}\\Bin\\.*MSBuild(?:TaskHost)?\.exe", RegexOptions.IgnoreCase)) { return new BuildEnvironment( @@ -246,7 +236,7 @@ private static BuildEnvironment TryFromMSBuildExeUnderVisualStudio(string msbuil ? $@".*\\MSBuild\\({CurrentToolsVersion}|\d+\.0)\\Bin\\.*" : $@".*\\MSBuild\\{CurrentToolsVersion}\\Bin\\.*"; - if (NativeMethodsShared.IsWindows && + if (NativeMethods.IsWindows && Regex.IsMatch(msbuildExe, msBuildPathPattern, RegexOptions.IgnoreCase)) { string visualStudioRoot = GetVsRootFromMSBuildAssembly(msbuildExe); @@ -376,8 +366,8 @@ private static string GetMSBuildExeFromVsRoot(string visualStudioRoot) "MSBuild", CurrentToolsVersion, "Bin", - NativeMethodsShared.ProcessorArchitecture == Framework.NativeMethods.ProcessorArchitectures.X64 ? "amd64" : - NativeMethodsShared.ProcessorArchitecture == Framework.NativeMethods.ProcessorArchitectures.ARM64 ? "arm64" : string.Empty, + NativeMethods.ProcessorArchitecture == NativeMethods.ProcessorArchitectures.X64 ? "amd64" : + NativeMethods.ProcessorArchitecture == NativeMethods.ProcessorArchitectures.ARM64 ? "arm64" : string.Empty, Constants.MSBuildExecutableName); } @@ -453,7 +443,7 @@ private static string GetProcessFromRunningProcess() private static string GetExecutingAssemblyPath() { - return ExecutingAssemblyPath; + return typeof(BuildEnvironmentHelper).GetAssemblyPath(); } private static string GetAppContextBaseDirectory() @@ -563,10 +553,8 @@ public BuildEnvironment( CurrentMSBuildExePath = currentMSBuildExePath; VisualStudioInstallRootDirectory = visualStudioPath; -#if !NO_FRAMEWORK_IVT - Framework.BuildEnvironmentState.s_runningTests = runningTests; - Framework.BuildEnvironmentState.s_runningInVisualStudio = runningInVisualStudio; -#endif + BuildEnvironmentState.s_runningTests = runningTests; + BuildEnvironmentState.s_runningInVisualStudio = runningInVisualStudio; if (!string.IsNullOrEmpty(currentMSBuildExePath)) { @@ -599,12 +587,12 @@ public BuildEnvironment( if (mode == BuildEnvironmentMode.VisualStudio) { // In Visual Studio, the entry-point MSBuild.exe is often from an arch-specific subfolder - MSBuildToolsDirectoryRoot = NativeMethodsShared.ProcessorArchitecture switch + MSBuildToolsDirectoryRoot = NativeMethods.ProcessorArchitecture switch { - NativeMethodsShared.ProcessorArchitectures.X86 => CurrentMSBuildToolsDirectory, - NativeMethodsShared.ProcessorArchitectures.X64 or NativeMethodsShared.ProcessorArchitectures.ARM64 + NativeMethods.ProcessorArchitectures.X86 => CurrentMSBuildToolsDirectory, + NativeMethods.ProcessorArchitectures.X64 or NativeMethods.ProcessorArchitectures.ARM64 => currentToolsDirectory.Parent?.FullName, - _ => throw new InternalErrorException("Unknown processor architecture " + NativeMethodsShared.ProcessorArchitecture), + _ => throw new InternalErrorException("Unknown processor architecture " + NativeMethods.ProcessorArchitecture), }; } else diff --git a/src/Shared/CopyOnWriteDictionary.cs b/src/Framework/Collections/CopyOnWriteDictionary.cs similarity index 100% rename from src/Shared/CopyOnWriteDictionary.cs rename to src/Framework/Collections/CopyOnWriteDictionary.cs diff --git a/src/Shared/ReadOnlyCollection.cs b/src/Framework/Collections/ReadOnlyCollection.cs similarity index 90% rename from src/Shared/ReadOnlyCollection.cs rename to src/Framework/Collections/ReadOnlyCollection.cs index c1754eaf86f..3c4bf19a9ce 100644 --- a/src/Shared/ReadOnlyCollection.cs +++ b/src/Framework/Collections/ReadOnlyCollection.cs @@ -5,7 +5,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using Microsoft.Build.Shared; +using Microsoft.Build.Framework; #nullable disable @@ -35,7 +35,7 @@ internal sealed class ReadOnlyCollection : ICollection, ICollection /// internal ReadOnlyCollection(IEnumerable backing) { - ErrorUtilities.VerifyThrow(backing != null, "Need backing collection"); + FrameworkErrorUtilities.VerifyThrow(backing != null, "Need backing collection"); _backing = backing; } @@ -98,7 +98,7 @@ private ICollection BackingCollection /// public void Add(T item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -106,7 +106,7 @@ public void Add(T item) /// public void Clear() { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -129,7 +129,7 @@ public bool Contains(T item) /// public void CopyTo(T[] array, int arrayIndex) { - ErrorUtilities.VerifyThrowArgumentNull(array); + ArgumentNullException.ThrowIfNull(array); ICollection backingCollection = _backing as ICollection; if (backingCollection != null) @@ -152,8 +152,7 @@ public void CopyTo(T[] array, int arrayIndex) /// public bool Remove(T item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); - return false; + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -185,7 +184,7 @@ IEnumerator IEnumerable.GetEnumerator() /// void ICollection.CopyTo(Array array, int index) { - ErrorUtilities.VerifyThrowArgumentNull(array); + ArgumentNullException.ThrowIfNull(array); int i = index; foreach (T entry in _backing) diff --git a/src/Shared/ReadOnlyEmptyCollection.cs b/src/Framework/Collections/ReadOnlyEmptyCollection.cs similarity index 89% rename from src/Shared/ReadOnlyEmptyCollection.cs rename to src/Framework/Collections/ReadOnlyEmptyCollection.cs index 128480dca68..e27c57212d1 100644 --- a/src/Shared/ReadOnlyEmptyCollection.cs +++ b/src/Framework/Collections/ReadOnlyEmptyCollection.cs @@ -4,7 +4,6 @@ using System; using System.Collections; using System.Collections.Generic; -using Microsoft.Build.Shared; #nullable disable @@ -84,7 +83,7 @@ object ICollection.SyncRoot /// public void Add(T item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -92,7 +91,7 @@ public void Add(T item) /// public void Clear() { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -115,8 +114,7 @@ public void CopyTo(T[] array, int arrayIndex) /// public bool Remove(T item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); - return false; + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -130,7 +128,7 @@ public IEnumerator GetEnumerator() /// /// Get an enumerator over an empty collection /// - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } diff --git a/src/Shared/ReadOnlyEmptyDictionary.cs b/src/Framework/Collections/ReadOnlyEmptyDictionary.cs similarity index 90% rename from src/Shared/ReadOnlyEmptyDictionary.cs rename to src/Framework/Collections/ReadOnlyEmptyDictionary.cs index a769a5156e8..917d6c2faa4 100644 --- a/src/Shared/ReadOnlyEmptyDictionary.cs +++ b/src/Framework/Collections/ReadOnlyEmptyDictionary.cs @@ -5,7 +5,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using Microsoft.Build.Shared; #nullable disable @@ -163,7 +162,7 @@ public V this[K key] set { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } } @@ -172,7 +171,7 @@ public V this[K key] /// public void Add(K key, V value) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -188,8 +187,7 @@ public bool ContainsKey(K key) /// public bool Remove(K key) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); - return false; + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -206,7 +204,7 @@ public bool TryGetValue(K key, out V value) /// public void Add(KeyValuePair item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -214,7 +212,7 @@ public void Add(KeyValuePair item) /// public void Clear() { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -237,8 +235,7 @@ public void CopyTo(KeyValuePair[] array, int arrayIndex) /// public bool Remove(KeyValuePair item) { - ErrorUtilities.ThrowInvalidOperation("OM_NotSupportedReadOnlyCollection"); - return false; + throw new InvalidOperationException(SR.CollectionIsReadOnly); } /// @@ -252,7 +249,7 @@ public IEnumerator> GetEnumerator() /// /// Get empty enumerator /// - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } diff --git a/src/Framework/ErrorUtilities.cs b/src/Framework/ErrorUtilities.cs index c0534973ccf..33df42fae62 100644 --- a/src/Framework/ErrorUtilities.cs +++ b/src/Framework/ErrorUtilities.cs @@ -62,6 +62,16 @@ internal static void VerifyThrowInternalLength([NotNull] string? parameterValue, } } + /// + /// Throws InternalErrorException. + /// This is only for situations that would mean that there is a bug in MSBuild itself. + /// + [DoesNotReturn] + internal static void ThrowInternalError(string message) + { + throw new InternalErrorException(message); + } + /// /// Throws InternalErrorException. /// This is only for situations that would mean that there is a bug in MSBuild itself. diff --git a/src/Shared/CoreCLRAssemblyLoader.cs b/src/Framework/Loader/CoreCLRAssemblyLoader.cs similarity index 99% rename from src/Shared/CoreCLRAssemblyLoader.cs rename to src/Framework/Loader/CoreCLRAssemblyLoader.cs index 69269b204a9..a43ecbf2c1b 100644 --- a/src/Shared/CoreCLRAssemblyLoader.cs +++ b/src/Framework/Loader/CoreCLRAssemblyLoader.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#if NET && FEATURE_ASSEMBLYLOADCONTEXT + using System; using System.Collections.Generic; using System.Diagnostics; @@ -199,3 +201,4 @@ private bool IsAssemblyAlreadyLoaded(string path) } } } +#endif diff --git a/src/Shared/LoadedType.cs b/src/Framework/Loader/LoadedType.cs similarity index 96% rename from src/Shared/LoadedType.cs rename to src/Framework/Loader/LoadedType.cs index a108e072da7..fe240c49bb8 100644 --- a/src/Shared/LoadedType.cs +++ b/src/Framework/Loader/LoadedType.cs @@ -6,7 +6,6 @@ using Microsoft.Build.Execution; using Microsoft.Build.Framework; - namespace Microsoft.Build.Shared { /// @@ -36,9 +35,9 @@ internal LoadedType( string? architecture = null, bool loadedViaMetadataLoadContext = false) { - ErrorUtilities.VerifyThrow(type != null, "We must have the type."); - ErrorUtilities.VerifyThrow(assemblyLoadInfo != null, "We must have the assembly the type was loaded from."); - ErrorUtilities.VerifyThrow(loadedAssembly is not null, "The assembly should always be loaded even if only by MetadataLoadContext."); + FrameworkErrorUtilities.VerifyThrow(type != null, "We must have the type."); + FrameworkErrorUtilities.VerifyThrow(assemblyLoadInfo != null, "We must have the assembly the type was loaded from."); + FrameworkErrorUtilities.VerifyThrow(loadedAssembly is not null, "The assembly should always be loaded even if only by MetadataLoadContext."); Type = type; Assembly = assemblyLoadInfo; diff --git a/src/Shared/MSBuildLoadContext.cs b/src/Framework/Loader/MSBuildLoadContext.cs similarity index 99% rename from src/Shared/MSBuildLoadContext.cs rename to src/Framework/Loader/MSBuildLoadContext.cs index db5417b9d78..cdbc40e3880 100644 --- a/src/Shared/MSBuildLoadContext.cs +++ b/src/Framework/Loader/MSBuildLoadContext.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#if NET && FEATURE_ASSEMBLYLOADCONTEXT + using System; using System.Collections.Immutable; using System.IO; @@ -120,3 +122,4 @@ protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) } } } +#endif diff --git a/src/Framework/NativeMethods.cs b/src/Framework/NativeMethods.cs index 7195d8ee36f..46aad3925dc 100644 --- a/src/Framework/NativeMethods.cs +++ b/src/Framework/NativeMethods.cs @@ -1146,7 +1146,6 @@ internal static bool MakeSymbolicLink(string newFileName, string existingFileNam /// internal static DateTime GetLastWriteFileUtcTime(string fullPath) { -#if !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS if (Traits.Instance.EscapeHatches.AlwaysDoImmutableFilesUpToDateCheck) { return LastWriteFileUtcTime(fullPath); @@ -1169,9 +1168,6 @@ internal static DateTime GetLastWriteFileUtcTime(string fullPath) } return modifiedTime; -#else - return LastWriteFileUtcTime(fullPath); -#endif DateTime LastWriteFileUtcTime(string path) { diff --git a/src/Build/Instance/ReflectableTaskPropertyInfo.cs b/src/Framework/ReflectableTaskPropertyInfo.cs similarity index 92% rename from src/Build/Instance/ReflectableTaskPropertyInfo.cs rename to src/Framework/ReflectableTaskPropertyInfo.cs index 0ec83c8c57e..3a5a3f842da 100644 --- a/src/Build/Instance/ReflectableTaskPropertyInfo.cs +++ b/src/Framework/ReflectableTaskPropertyInfo.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Reflection; using Microsoft.Build.Framework; -using Microsoft.Build.Shared; #nullable disable @@ -34,7 +33,7 @@ internal class ReflectableTaskPropertyInfo : TaskPropertyInfo internal ReflectableTaskPropertyInfo(TaskPropertyInfo taskPropertyInfo, Type taskType) : base(taskPropertyInfo.Name, taskPropertyInfo.PropertyType, taskPropertyInfo.Output, taskPropertyInfo.Required) { - ErrorUtilities.VerifyThrowArgumentNull(taskType); + ArgumentNullException.ThrowIfNull(taskType); _taskType = taskType; } @@ -78,7 +77,7 @@ internal PropertyInfo Reflection if (_propertyInfo == null) { _propertyInfo = _taskType.GetProperty(Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); - ErrorUtilities.VerifyThrow(_propertyInfo != null, "Could not find property {0} on type {1} that the task factory indicated should exist.", Name, _taskType.FullName); + FrameworkErrorUtilities.VerifyThrow(_propertyInfo != null, $"Could not find property {Name} on type {_taskType.FullName} that the task factory indicated should exist."); } return _propertyInfo; diff --git a/src/Framework/Resources/SR.resx b/src/Framework/Resources/SR.resx index a21aa59f83b..91364f3bab2 100644 --- a/src/Framework/Resources/SR.resx +++ b/src/Framework/Resources/SR.resx @@ -169,4 +169,28 @@ The item metadata "%({0})" cannot be applied to the path "{1}". {2} UE: This message is shown when the user tries to perform path manipulations using one of the built-in item metadata e.g. %(RootDir), on an item-spec that's not a valid path. LOCALIZATION: "{2}" is a localized message from a CLR/FX exception. + + This collection is read-only. + + + The string "{0}" cannot be converted to a boolean (true/false) value. + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.cs.xlf b/src/Framework/Resources/xlf/SR.cs.xlf index dbb308c57cf..3b7bf110d8b 100644 --- a/src/Framework/Resources/xlf/SR.cs.xlf +++ b/src/Framework/Resources/xlf/SR.cs.xlf @@ -57,6 +57,21 @@ Hodnota nemůže být prázdný řetězec. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Řetězec {0} nelze převést na logickou hodnotu (true/false). + + + + This collection is read-only. + Tato kolekce je jen pro čtení. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Při pokusu o vygenerování cesty odkazovaného sestavení z cesty {0} a monikeru rozhraní {1} došlo k chybě. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Cesta {0} používaná pro protokoly ladění je příliš dlouhá. Nastavte ji na kratší hodnotu pomocí proměnné prostředí MSBUILDDEBUGPATH nebo změňte konfigurace vašeho systému, aby povolovala dlouhé cesty. @@ -67,6 +82,16 @@ Nepodařilo se vytvořit dočasný soubor. Složka dočasných souborů je plná nebo cesta k této složce není správná. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Při rozbalování fileSpec s globs: fileSpec došlo k výjimce: {0}, za předpokladu, že se jedná o název souboru. Výjimka: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + Položka {0} má atribut {1} s hodnotou {2}, kterou nebylo možné převést na hodnotu {3}. + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Metadata položky %({0}) nelze použít na cestu {1}. {2} @@ -87,6 +112,21 @@ Cesta: {0} překračuje maximální limit pro cestu k OS. Plně kvalifikovaný název souboru musí být kratší než {1} znaků. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + Verze {0} rozhraní .NET Framework není podporovaná. Zadejte hodnotu z výčtu Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + Verze {0} rozhraní .NET Framework není podporovaná, pokud je jako cíl explicitně určená sada Windows SDK, která je podporovaná jenom v rozhraní .NET 4.5 nebo novějším. Určete hodnotu Version45 nebo vyšší z výčtu Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Verze {0} sady Visual Studio není podporovaná. Zadejte hodnotu z výčtu Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.de.xlf b/src/Framework/Resources/xlf/SR.de.xlf index a1a72d7aa6b..b16983f95a3 100644 --- a/src/Framework/Resources/xlf/SR.de.xlf +++ b/src/Framework/Resources/xlf/SR.de.xlf @@ -57,6 +57,21 @@ Der Wert darf keine leere Zeichenfolge sein. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Die Zeichenfolge "{0}" kann nicht in einen booleschen Wert (true/false) konvertiert werden. + + + + This collection is read-only. + Diese Sammlung ist schreibgeschützt. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Fehler beim Versuch, einen Referenzassemblypfad aus dem Pfad "{0}" und dem Frameworkmoniker "{1}" zu generieren. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Der für Debugprotokolle verwendete Pfad "{0}" ist zu lang. Legen Sie den Wert mithilfe der Umgebungsvariablen MSBUILDDEBUGPATH auf einen kürzeren Wert fest, oder ändern Sie die Systemkonfiguration so, dass lange Pfade zulässig sind. @@ -67,6 +82,16 @@ Fehler beim Erstellen einer temporären Datei. Der Ordner für temporäre Dateien ist voll, oder der Pfad ist falsch. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Eine Ausnahme ist beim Erweitern einer fileSpec mit Globs aufgetreten: fileSpec: „{0}“, angenommen, es handelt sich um einen Dateinamen. Ausnahme: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + Das Element "{0}" enthält das {1}-Attribut mit dem Wert "{2}", der nicht in "{3}" konvertiert werden konnte. + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Die %({0})-Elementmetadaten können nicht auf den Pfad "{1}" angewendet werden. {2} @@ -87,6 +112,21 @@ Der Pfad "{0}" überschreitet das maximale Pfadlimit des Betriebssystems. Der vollqualifizierte Dateiname muss weniger als {1} Zeichen umfassen. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + Die .NET Framework-Version "{0}" wird nicht unterstützt. Geben Sie einen Wert aus der Enumeration "Microsoft.Build.Utilities.TargetDotNetFrameworkVersion" an. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + .NET Framework, Version "{0}" wird nicht unterstützt, wenn das Windows SDK das explizite Ziel ist, da dies nur unter .NET 4.5 und höher unterstützt wird. Geben Sie einen Wert aus der Enumeration "Microsoft.Build.Utilities.TargetDotNetFrameworkVersion", Version45 oder höher an. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Visual Studio-Version "{0}" wird nicht unterstützt. Geben Sie einen Wert aus der Enumeration "Microsoft.Build.Utilities.VisualStudioVersion" an. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.es.xlf b/src/Framework/Resources/xlf/SR.es.xlf index 8f506dcd824..e8fdc990dcc 100644 --- a/src/Framework/Resources/xlf/SR.es.xlf +++ b/src/Framework/Resources/xlf/SR.es.xlf @@ -57,6 +57,21 @@ El valor no puede ser una cadena vacía. + + The string "{0}" cannot be converted to a boolean (true/false) value. + La cadena "{0}" no puede convertirse en un valor booleano (true/false). + + + + This collection is read-only. + Esta colección es de solo lectura. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Error al intentar generar una ruta de acceso de ensamblado de referencia a partir de la ruta de acceso "{0}" y del moniker "{1}" de la versión de .NET Framework. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. La ruta de acceso "{0}" usada para los registros de depuración es demasiado larga. Establézcalo en un valor más corto con la variable de entorno MSBUILDDEBUGPATH o cambie la configuración del sistema para permitir rutas de acceso largas. @@ -67,6 +82,16 @@ No se pudo crear un archivo temporal. La carpeta de archivos temporales está llena o su ruta de acceso es incorrecta. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Se produjo una excepción al expandir un fileSpec con globs: fileSpec: "{0}"; suponiendo que es un nombre de archivo. Excepción: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + El elemento "{0}" tiene el atributo "{1}" con el valor "{2}" que no se pudo convertir a "{3}". + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Los metadatos "%({0})" del elemento no pueden aplicarse a la ruta de acceso "{1}". {2} @@ -87,6 +112,21 @@ La ruta de acceso {0} supera el límite máximo para la ruta de acceso del sistema operativo. El nombre de archivo completo debe ser inferior a {1} caracteres. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + La versión "{0}" no es compatible. Especifique un valor de la enumeración Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + La versión "{0}" de .NET Framework no es compatible cuando se establece de forma explícita Windows SDK como destino, que solo se admite en .NET 4.5 y posterior. Especifique un valor de la enumeración Microsoft.Build.Utilities.TargetDotNetFrameworkVersion que sea Version45 o posterior. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + La versión "{0}" de Visual Studio no es compatible. Especifique un valor de la enumeración Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.fr.xlf b/src/Framework/Resources/xlf/SR.fr.xlf index c3c3c0fcc32..5cb761031a6 100644 --- a/src/Framework/Resources/xlf/SR.fr.xlf +++ b/src/Framework/Resources/xlf/SR.fr.xlf @@ -57,6 +57,21 @@ La valeur ne peut pas être une chaîne vide. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Impossible de convertir la chaîne "{0}" en valeur booléenne (true/false). + + + + This collection is read-only. + Cette collection est en lecture seule. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Une erreur s'est produite lors de la tentative de génération d'un chemin d'assembly de référence à partir du chemin d'accès "{0}" et du moniker du Framework "{1}". {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Le chemin d’accès « {0} » utilisé pour les journaux de débogage est trop long. Définissez-la sur une valeur plus courte à l’aide de la variable d’environnement MSBUILDDEBUGPATH ou modifiez votre configuration système pour autoriser les chemins longs. @@ -67,6 +82,16 @@ Échec de la création d’un fichier temporaire. Le dossier de fichiers temporaires est plein ou son chemin est incorrect. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Une exception s’est produite lors du développement d’un fileSpec avec globs: fileSpec: '{0}', en supposant qu’il s’agit d’un nom de fichier. Exception : {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + L'élément "{0}" a l'attribut "{1}" avec la valeur "{2}", qui n'a pas pu être convertie en "{3}". + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Impossible d'appliquer la métadonnée d'élément "%({0})" au chemin d'accès "{1}". {2} @@ -87,6 +112,21 @@ Le chemin {0} dépasse la limite maximale de chemin du système d'exploitation. Le nom du fichier qualifié complet doit contenir moins de {1} caractères. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + La version "{0}" de .NET Framework n'est pas prise en charge. Spécifiez une valeur de l'énumération Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + La version "{0}" de .NET Framework n'est pas prise en charge lors du ciblage explicite du SDK Windows, qui est pris en charge uniquement par .NET 4.5 et ultérieur. Spécifiez une valeur de l'énumération Microsoft.Build.Utilities.TargetDotNetFrameworkVersion correspondant à la version 4.5 (Version45) ou ultérieure. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + La version "{0}" de Visual Studio n'est pas prise en charge. Spécifiez une valeur de l'énumération Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.it.xlf b/src/Framework/Resources/xlf/SR.it.xlf index b100bcf69d6..6ebb060c611 100644 --- a/src/Framework/Resources/xlf/SR.it.xlf +++ b/src/Framework/Resources/xlf/SR.it.xlf @@ -57,6 +57,21 @@ Il valore non può essere una stringa vuota. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Non è possibile convertire la stringa "{0}" in un valore booleano (true/false). + + + + This collection is read-only. + Raccolta di sola lettura. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Si è verificato un errore durante il tentativo di generare un percorso dell'assembly di riferimento dal "{0}" e dal moniker del framework "{1}". {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Il percorso "{0}" usato per i log di debug è troppo lungo. Impostarlo su un valore più breve usando la variabile dell'ambiente MSBUILDDEBUGPATH o modificare la configurazione del sistema per consentire percorsi lunghi. @@ -67,6 +82,16 @@ Non è stato possibile creare un file temporaneo. La cartella dei file temporanei è piena oppure il percorso è errato. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Si è verificata un'eccezione durante l'espansione di un fileSpec con GLOBS: fileSpec: "{0}", presupponendo che si tratti di un nome di file. Eccezione: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + L'elemento "{0}" include l'attributo "{1}" con il valore "{2}" che non è stato possibile convertire in "{3}". + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Non è possibile applicare i metadati dell'elemento "%({0})" al percorso "{1}". {2} @@ -87,6 +112,21 @@ Il percorso {0} supera il limite massimo dei percorsi del sistema operativo. Il nome completo del file deve essere composto da meno di {1}. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + La versione "{0}" di .NET Framework non è supportata. Specificare un valore dall'enumerazione Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + La versione "{0}" di .NET Framework non è supportata se è destinata in modo esplicito a Windows SDK, che è supportato solo da .NET 4.5 e versioni successive. Specificare un valore dell'enumerazione Microsoft.Build.Utilities.TargetDotNetFrameworkVersion che sia Version45 o successivo. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + La versione "{0}" di Visual Studio non è supportata. Specificare un valore dall'enumerazione Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.ja.xlf b/src/Framework/Resources/xlf/SR.ja.xlf index 8c20f664b9e..800dbc3f2cd 100644 --- a/src/Framework/Resources/xlf/SR.ja.xlf +++ b/src/Framework/Resources/xlf/SR.ja.xlf @@ -57,6 +57,21 @@ 値を空の文字列にすることはできません。 + + The string "{0}" cannot be converted to a boolean (true/false) value. + 文字列 "{0}" をブール値 (true/false) に変換することはできません。 + + + + This collection is read-only. + このコレクションは読み取り専用です。 + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + 参照アセンブリ パスをパス "{0}" とフレームワーク モニカー "{1}" から生成しようとしたときに、エラーが発生しました。{2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. デバッグ ログに使用されるパス "{0}" が長すぎます。MSBUILDDEBUGPATH 環境変数を使用して短い値に設定するか、長いパスを許可するようにシステム構成を変更してください。 @@ -67,6 +82,16 @@ 一時ファイルを作成できませんでした。一時ファイル フォルダーがいっぱいであるか、またはそのパスが正しくありません。{0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + glob を使用して fileSpec を展開中に例外が発生しました: fileSpec: "{0}"、これはファイル名であると仮定します。例外: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + 項目 "{0}" は、"{3}" に変換できなかった値 "{2}" を伴う属性 "{1}" を含んでいます。 + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} 項目メタデータ "%({0})" をパス "{1}" に適用できません。{2} @@ -87,6 +112,21 @@ パス: {0} は OS のパスの上限を越えています。完全修飾のファイル名は {1} 文字以下にする必要があります。 + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + .NET Framework のバージョン "{0}" はサポートされていません。列挙 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion から値を指定してください。 + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + Windows SDK を明示的にターゲットとする場合、.NET Framework のバージョン "{0}" はサポートされません。Windows SDK は、.NET 4.5 以降でのみサポートされています。列挙 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion から Version45 以上の値を指定してください。 + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Visual Studio のバージョン "{0}" はサポートされていません。列挙 Microsoft.Build.Utilities.VisualStudioVersion から値を指定してください。 + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.ko.xlf b/src/Framework/Resources/xlf/SR.ko.xlf index 3fe35ab23f1..f16d86f8415 100644 --- a/src/Framework/Resources/xlf/SR.ko.xlf +++ b/src/Framework/Resources/xlf/SR.ko.xlf @@ -57,6 +57,21 @@ 값은 빈 문자열일 수 없습니다. + + The string "{0}" cannot be converted to a boolean (true/false) value. + "{0}" 문자열을 부울 값(true/false)으로 변환할 수 없습니다. + + + + This collection is read-only. + 이 컬렉션은 읽기 전용입니다. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + "{0}" 경로 및 프레임워크 모니커 "{1}"에서 참조 어셈블리 경로를 생성하는 동안 오류가 발생했습니다. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. 디버그 로그에 사용된 경로 "{0}"이(가) 너무 깁니다. MSBUILDDEBUGPATH 환경 변수를 사용하여 값을 더 짧게 설정하거나 긴 경로를 허용하도록 시스템 구성을 변경합니다. @@ -67,6 +82,16 @@ 임시 파일을 만들지 못했습니다. 임시 파일 폴더가 꽉 찼거나 경로가 올바르지 않습니다. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + glob를 사용하여 fileSpec을 확장하는 동안 예외가 발생했습니다. fileSpec: "{0}", 파일 이름이라고 가정합니다. 예외: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + "{0}" 항목에 "{3}"(으)로 변환할 수 없는 "{2}" 값이 있는 "{1}" 특성이 있습니다. + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} 항목 메타데이터 "%({0})"을(를) "{1}" 경로에 적용할 수 없습니다. {2} @@ -87,6 +112,21 @@ 경로: {0}은(는) OS 최대 경로 제한을 초과합니다. 정규화된 파일 이름은 {1}자 이하여야 합니다. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + .NET Framework 버전 "{0}"이(가) 지원되지 않습니다. Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 열거형에서 값을 지정하세요. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + .NET 4.5 이상에서만 지원되는 Windows SDK를 명시적으로 대상으로 지정하는 경우 .NET Framework 버전 "{0}"이(가) 지원되지 않습니다. Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 열거형에서 Version45 이상인 값을 지정하세요. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Visual Studio 버전 "{0}"이(가) 지원되지 않습니다. Microsoft.Build.Utilities.VisualStudioVersion 열거형에서 값을 지정하세요. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.pl.xlf b/src/Framework/Resources/xlf/SR.pl.xlf index 062f34dedf1..8ab65f78025 100644 --- a/src/Framework/Resources/xlf/SR.pl.xlf +++ b/src/Framework/Resources/xlf/SR.pl.xlf @@ -57,6 +57,21 @@ Wartość nie może być ciągiem pustym. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Ciągu „{0}” nie można przekonwertować na wartość logiczną (prawda/fałsz). + + + + This collection is read-only. + Ta kolekcja jest tylko do odczytu. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Wystąpił błąd podczas próby wygenerowania ścieżki zestawu odwołania ze ścieżki „{0}” i monikera struktury „{1}”. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Ścieżka „{0}” używana w dziennikach debugowania jest za długa. Ustaw ją na krótszą wartość przy użyciu zmiennej środowiskowej MSBUILDEBUGPATH lub zmień konfigurację systemu, aby zezwolić na długie ścieżki. @@ -67,6 +82,16 @@ Nie można utworzyć pliku tymczasowego. Folder plików tymczasowych jest zapełniony lub jego ścieżka jest niepoprawna. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Wystąpił wyjątek podczas rozwijania elementu fileSpec za pomocą globów: fileSpec: „{0}”, przy założeniu, że jest to nazwa pliku. Wyjątek: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + Element „{0}” ma atrybut „{1}” o wartości „{2}”, którego nie można przekonwertować na „{3}”. + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Elementu metadanych „%({0})” nie można zastosować do ścieżki „{1}”. {2} @@ -87,6 +112,21 @@ Ścieżka: {0} przekracza limit maksymalnej długości ścieżki w systemie operacyjnym. W pełni kwalifikowana nazwa pliku musi się składać z mniej niż {1} znaków. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + Program .NET Framework w wersji „{0}” nie jest obsługiwany. Podaj wartość z wyliczenia Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + Program .NET Framework w wersji „{0}” nie jest obsługiwany, jeśli jawnym obiektem docelowym jest zestaw SDK systemu Windows, ponieważ taki zestaw jest obsługiwany tylko na platformie .NET w wersji 4.5 lub nowszej. Podaj wartość z wyliczenia Microsoft.Build.Utilities.TargetDotNetFrameworkVersion, która wynosi co najmniej Version45. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Program Visual Studio w wersji „{0}” nie jest obsługiwany. Podaj wartość z wyliczenia Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.pt-BR.xlf b/src/Framework/Resources/xlf/SR.pt-BR.xlf index a6a6c48f39d..d0265d397b2 100644 --- a/src/Framework/Resources/xlf/SR.pt-BR.xlf +++ b/src/Framework/Resources/xlf/SR.pt-BR.xlf @@ -57,6 +57,21 @@ O valor não pode ser uma cadeia de caracteres vazia. + + The string "{0}" cannot be converted to a boolean (true/false) value. + A cadeia de caracteres "{0}" não pode ser convertida em um valor booliano (true/false). + + + + This collection is read-only. + Esta coleção é somente leitura. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Erro ao tentar gerar um caminho de assembly de referência no caminho "{0}" e o moniker de estrutura "{1}". {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. O caminho "{0}" usado para logs de depuração é muito longo. Defina-o para um valor mais curto usando a variável de ambiente MSBUILDDEBUGPATH ou altere a configuração do sistema para permitir caminhos longos. @@ -67,6 +82,16 @@ Falha ao criar um arquivo temporário. A pasta de arquivos temporários está cheia ou o caminho está incorreto. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Ocorreu uma exceção ao expandir um fileSpec com globs: fileSpec: "{0}", assumindo que se trata de um nome de arquivo. Exceção: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + O item "{0}" tem atributo "{1}" com valor "{2}" que não pôde ser convertido para "{3}". + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Os metadados do item "%({0})" não podem ser aplicados ao caminho "{1}". {2} @@ -87,6 +112,21 @@ Caminho: {0} excede o limite máximo do caminho do SO. O nome do arquivo totalmente qualificado deve ter menos de {1} caracteres. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + Não há suporte para a versão "{0}" do .NET Framework. Especifique um valor da enumeração Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + Não há suporte para a versão "{0}" do .NET Framework quando o destino for explicitamente o SDK do Windows, que só tem suporte no .NET 4.5 e posterior. Especifique um valor da enumeração Microsoft.Build.Utilities.TargetDotNetFrameworkVersion que seja Version45 ou acima. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + O Visual Studio versão "{0}" não tem suporte. Especifique um valor da enumeração Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.ru.xlf b/src/Framework/Resources/xlf/SR.ru.xlf index a8d52db0742..9a075bf2564 100644 --- a/src/Framework/Resources/xlf/SR.ru.xlf +++ b/src/Framework/Resources/xlf/SR.ru.xlf @@ -57,6 +57,21 @@ Значение не может быть пустой строкой. + + The string "{0}" cannot be converted to a boolean (true/false) value. + Строка "{0}" не может быть преобразована в логическое значение (истина/ложь). + + + + This collection is read-only. + Эта коллекция доступна только для чтения. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + Ошибка при попытке создать ссылочный путь к сборке из пути "{0}" и моникер инфраструктуры "{1}". {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Путь "{0}", используемый для журналов отладки, слишком длинный. Установите более короткое значение, используя переменную среду MSBUILDDEBUGPATH, или измените конфигурацию системы, чтобы разрешить длинные пути. @@ -67,6 +82,16 @@ Не удалось создать временный файл. Папка временных файлов переполнена, или указан неверный путь. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + Возникло исключение при расширении fileSpec со стандартными масками: fileSpec: "{0}", предполагая, что это имя файла. Исключение: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + У элемента "{0}" имеется атрибут "{1}" со значением "{2}", который не удалось преобразовать в "{3}". + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} Не удается применить метаданные элемента "%({0})" к пути "{1}". {2} @@ -87,6 +112,21 @@ Длина пути {0} превышает максимально допустимую в ОС. Символов в полном имени файла должно быть не больше {1}. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + .NET Framework версии "{0}" не поддерживается. Укажите значение из перечисления Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + При явном использовании пакета Windows SDK платформа .NET Framework версии "{0}" не поддерживается; она поддерживается только платформой .NET 4.5 и более поздними версиями. Укажите значение из перечисления Microsoft.Build.Utilities.TargetDotNetFrameworkVersion версии Version45 или более поздней. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Visual Studio версии "{0}" не поддерживается. Укажите значение из перечисления Microsoft.Build.Utilities.VisualStudioVersion. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.tr.xlf b/src/Framework/Resources/xlf/SR.tr.xlf index 8d4e0fe3651..69d567ac46f 100644 --- a/src/Framework/Resources/xlf/SR.tr.xlf +++ b/src/Framework/Resources/xlf/SR.tr.xlf @@ -57,6 +57,21 @@ Değer boş bir dize olamaz. + + The string "{0}" cannot be converted to a boolean (true/false) value. + "{0}" dizesi bir boole (doğru/yanlış) değerine dönüştürülemiyor. + + + + This collection is read-only. + Bu koleksiyon salt okunur. + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + "{0}" yolundan ve "{1}" framework adından bir başvuru bütünleştirilmiş kod yolu oluşturmaya çalışılırken bir hata oluştu. {2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. Hata ayıklama günlükleri için kullanılan "{0}" yolu çok uzun. MSBUILDDEBUGPATH ortam değişkenini kullanarak yolu daha kısa bir değere ayarlayın veya sistem yapılandırmanızı uzun yollara izin verecek şekilde değiştirin. @@ -67,6 +82,16 @@ Geçici bir dosya oluşturulamadı. Geçici dosyalar klasörü dolu veya yolu hatalı. {0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + globs: fileSpec: "{0}" ile bir fileSpec genişletilirken özel bir durum oluştu, bunun bir dosya adı olduğu varsayıldı. Özel Durum: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + "{0}" öğesinin, "{3}" değerine dönüştürülemeyen "{2}" değerine sahip "{1}" özniteliği var. + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} "%({0})" öğe meta verisi "{1}" yoluna uygulanamıyor. {2} @@ -87,6 +112,21 @@ Yol: {0}, işletim sisteminin en yüksek yol sınırını aşıyor. Tam dosya adı en fazla {1} karakter olmalıdır. + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + .NET Framework "{0}" sürümü desteklenmiyor. Lütfen Microsoft.Build.Utilities.TargetDotNetFrameworkVersion sabit listesinden bir değer belirtin. + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + Yalnızca .NET 4.5 ve sonraki sürümlerde desteklenen Windows SDK açıkça hedeflenirken .NET Framework "{0}" sürümü desteklenmez. Lütfen Microsoft.Build.Utilities.TargetDotNetFrameworkVersion sabit listesinden Sürüm 45 veya üzerinde bir değer belirtin. + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + Visual Studio "{0}" sürümü desteklenmiyor. Lütfen Microsoft.Build.Utilities.VisualStudioVersion sabit listesinden bir değer belirtin. + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.zh-Hans.xlf b/src/Framework/Resources/xlf/SR.zh-Hans.xlf index 58257410671..b1b11c53f40 100644 --- a/src/Framework/Resources/xlf/SR.zh-Hans.xlf +++ b/src/Framework/Resources/xlf/SR.zh-Hans.xlf @@ -57,6 +57,21 @@ 值不能为空字符串。 + + The string "{0}" cannot be converted to a boolean (true/false) value. + 无法将字符串“{0}”转换为布尔值(true/false)。 + + + + This collection is read-only. + 此集合是只读的。 + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + 尝试从路径“{0}”和框架名字对象“{1}”生成引用程序集路径时出错。{2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. 用于调试日志的路径 "{0}" 太长。使用 MSBUILDDEBUGPATH 环境变量将其设置为较短值,或更改系统配置以允许长路径。 @@ -67,6 +82,16 @@ 未能创建临时文件。临时文件文件夹已满或其路径不正确。{0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + 使用 glob 展开 fileSpec 时发生异常: fileSpec:“{0}”,系统假定它是文件名。异常: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + 项“{0}”具有值为“{2}”的特性“{1}”,该值未能转换为“{3}”。 + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} 无法将项元数据“%({0})”应用于路径“{1}”。{2} @@ -87,6 +112,21 @@ 路径: {0} 超过 OS 最大路径限制。完全限定的文件名必须少于 {1} 个字符。 + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + 不支持 .NET Framework 版本“{0}”。请指定枚举 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 中的某个值。 + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + 当明确以 Windows SDK 为目标时,不支持 .NET Framework 版本“{0}”,Windows SDK 只在 .NET 4.5 及更高版本上受支持。请指定枚举 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 中 Version45 或以上的值。 + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + 不支持 Visual Studio 版本“{0}”。请指定枚举 Microsoft.Build.Utilities.VisualStudioVersion 中的某个值。 + + \ No newline at end of file diff --git a/src/Framework/Resources/xlf/SR.zh-Hant.xlf b/src/Framework/Resources/xlf/SR.zh-Hant.xlf index c7c043b9d7d..99900aefdef 100644 --- a/src/Framework/Resources/xlf/SR.zh-Hant.xlf +++ b/src/Framework/Resources/xlf/SR.zh-Hant.xlf @@ -57,6 +57,21 @@ 值不可為空字串。 + + The string "{0}" cannot be converted to a boolean (true/false) value. + 無法將字串 "{0}" 轉換成布林值 (true/false)。 + + + + This collection is read-only. + 這是一個唯讀集合。 + + + + When attempting to generate a reference assembly path from the path "{0}" and the framework moniker "{1}" there was an error. {2} + 嘗試從路徑 "{0}" 和架構 Moniker "{1}" 產生參考組件路徑時,發生錯誤。{2} + + The path "{0}" used for debug logs is too long. Set it to a shorter value using the MSBUILDDEBUGPATH environment variable or change your system configuration to allow long paths. 用於偵錯記錄檔 "{0}" 的路徑太長。使用 MSBUILDDEBUGPATH 環境變數將它設定為較短的值,或變更您的系統設定以允許長路徑。 @@ -67,6 +82,16 @@ 無法建立暫存檔案。暫存檔案資料夾已滿或其路徑錯誤。{0} + + An exception occurred while expanding a fileSpec with globs: fileSpec: "{0}", assuming it is a file name. Exception: {1} + 展開具有 glob 的 fileSpec 時發生例外狀況: fileSpec: "{0}" (假設它是檔案名稱)。例外狀況: {1} + + + + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + 項目 "{0}" 的屬性 "{1}" 的值為 "{2}",不能轉換為 "{3}"。 + + The item metadata "%({0})" cannot be applied to the path "{1}". {2} 無法將項目中繼資料 "%({0})" 套用至路徑 "{1}"。{2} @@ -87,6 +112,21 @@ 路徑: {0} 超過 OS 路徑上限。完整檔案名稱必須少於 {1} 個字元。 + + .NET Framework version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + 不支援 .NET Framework 版本 "{0}"。請從列舉 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 中指定值。 + + + + .NET Framework version "{0}" is not supported when explicitly targeting the Windows SDK, which is only supported on .NET 4.5 and later. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion that is Version45 or above. + 明確地以 Windows SDK 為目標時,不支援 .NET Framework 版本 "{0}",只有 .NET 4.5 及更新版本才予以支援。請從 Version45 (含) 以上版本的列舉 Microsoft.Build.Utilities.TargetDotNetFrameworkVersion 中指定值。 + + + + Visual Studio version "{0}" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion. + 不支援 Visual Studio 版本 "{0}"。請從列舉 Microsoft.Build.Utilities.VisualStudioVersion 中指定值。 + + \ No newline at end of file diff --git a/src/Shared/SolutionConfiguration.cs b/src/Framework/SolutionConfiguration.cs similarity index 100% rename from src/Shared/SolutionConfiguration.cs rename to src/Framework/SolutionConfiguration.cs diff --git a/src/Framework/StringBuilderCache.cs b/src/Framework/StringBuilderCache.cs index 929411cdddc..71cb6f5b2c3 100644 --- a/src/Framework/StringBuilderCache.cs +++ b/src/Framework/StringBuilderCache.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; using System.Text; -#if DEBUG && !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS +#if DEBUG using Microsoft.Build.Eventing; #endif @@ -50,7 +50,7 @@ public static StringBuilder Acquire(int capacity = 16 /*StringBuilder.DefaultCap if (capacity <= sb.Capacity) { sb.Length = 0; // Equivalent of sb.Clear() that works on .Net 3.5 -#if DEBUG && !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS +#if DEBUG MSBuildEventSource.Log.ReusableStringBuilderFactoryStart(hash: sb.GetHashCode(), newCapacity: capacity, oldCapacity: sb.Capacity, type: "sbc-hit"); #endif return sb; @@ -59,7 +59,7 @@ public static StringBuilder Acquire(int capacity = 16 /*StringBuilder.DefaultCap } StringBuilder stringBuilder = new StringBuilder(capacity); -#if DEBUG && !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS +#if DEBUG MSBuildEventSource.Log.ReusableStringBuilderFactoryStart(hash: stringBuilder.GetHashCode(), newCapacity: capacity, oldCapacity: stringBuilder.Capacity, type: "sbc-miss"); #endif return stringBuilder; @@ -92,7 +92,7 @@ public static void Release(StringBuilder sb) Debug.Assert(StringBuilderCache.t_cachedInstance == null, "Unexpected replacing of other StringBuilder."); StringBuilderCache.t_cachedInstance = sb; } -#if DEBUG && !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS +#if DEBUG MSBuildEventSource.Log.ReusableStringBuilderFactoryStop(hash: sb.GetHashCode(), returningCapacity: sb.Capacity, returningLength: sb.Length, type: sb.Capacity <= MAX_BUILDER_SIZE ? "sbc-return" : "sbc-discard"); #endif } diff --git a/src/Shared/AssemblyLoadInfo.cs b/src/Framework/Utilities/AssemblyLoadInfo.cs similarity index 93% rename from src/Shared/AssemblyLoadInfo.cs rename to src/Framework/Utilities/AssemblyLoadInfo.cs index 931d96a5480..d347119e4b7 100644 --- a/src/Shared/AssemblyLoadInfo.cs +++ b/src/Framework/Utilities/AssemblyLoadInfo.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO; using Microsoft.Build.BackEnd; +using Microsoft.Build.Framework; #nullable disable @@ -24,9 +25,9 @@ internal abstract class AssemblyLoadInfo : ITranslatable, IEquatable internal static AssemblyLoadInfo Create(string assemblyName, string assemblyFile) { - ErrorUtilities.VerifyThrow((!string.IsNullOrEmpty(assemblyName)) || (!string.IsNullOrEmpty(assemblyFile)), + FrameworkErrorUtilities.VerifyThrow((!string.IsNullOrEmpty(assemblyName)) || (!string.IsNullOrEmpty(assemblyFile)), "We must have either the assembly name or the assembly file/path."); - ErrorUtilities.VerifyThrow((assemblyName == null) || (assemblyFile == null), + FrameworkErrorUtilities.VerifyThrow((assemblyName == null) || (assemblyFile == null), "We must not have both the assembly name and the assembly file/path."); if (assemblyName != null) @@ -107,7 +108,7 @@ public override bool Equals(Object obj) public void Translate(ITranslator translator) { - ErrorUtilities.VerifyThrow(translator.Mode == TranslationDirection.WriteToStream, "write only"); + FrameworkErrorUtilities.VerifyThrow(translator.Mode == TranslationDirection.WriteToStream, "write only"); string assemblyName = AssemblyName; string assemblyFile = AssemblyFile; translator.Translate(ref assemblyName); @@ -193,7 +194,7 @@ private sealed class AssemblyLoadInfoWithFile : AssemblyLoadInfo /// internal AssemblyLoadInfoWithFile(string assemblyFile) { - ErrorUtilities.VerifyThrow(Path.IsPathRooted(assemblyFile), "Assembly file path should be rooted"); + FrameworkErrorUtilities.VerifyThrow(Path.IsPathRooted(assemblyFile), "Assembly file path should be rooted"); _assemblyFile = assemblyFile; } diff --git a/src/Shared/AssemblyNameComparer.cs b/src/Framework/Utilities/AssemblyNameComparer.cs similarity index 100% rename from src/Shared/AssemblyNameComparer.cs rename to src/Framework/Utilities/AssemblyNameComparer.cs diff --git a/src/Shared/AssemblyNameExtension.cs b/src/Framework/Utilities/AssemblyNameExtension.cs similarity index 98% rename from src/Shared/AssemblyNameExtension.cs rename to src/Framework/Utilities/AssemblyNameExtension.cs index 9f4b12b918e..0539ff0d464 100644 --- a/src/Shared/AssemblyNameExtension.cs +++ b/src/Framework/Utilities/AssemblyNameExtension.cs @@ -10,6 +10,7 @@ using System.Runtime.Serialization; using System.Text; using Microsoft.Build.BackEnd; +using Microsoft.Build.Framework; #nullable disable @@ -18,7 +19,7 @@ namespace Microsoft.Build.Shared /// /// Specifies the parts of the assembly name to partially match /// - [FlagsAttribute] + [Flags] internal enum PartialComparisonFlags : int { /// @@ -324,7 +325,7 @@ internal bool HasProcessorArchitectureInFusionName /// internal void ReplaceVersion(Version version) { - ErrorUtilities.VerifyThrow(!immutable, "Object is immutable cannot replace the version"); + FrameworkErrorUtilities.VerifyThrow(!immutable, "Object is immutable cannot replace the version"); CreateAssemblyName(); if (asAssemblyName.Version != version) { @@ -381,7 +382,7 @@ internal IEnumerable RemappedFromEnumerator /// internal void AddRemappedAssemblyName(AssemblyNameExtension extensionToAdd) { - ErrorUtilities.VerifyThrow(extensionToAdd.Immutable, "ExtensionToAdd is not immutable"); + FrameworkErrorUtilities.VerifyThrow(extensionToAdd.Immutable, "ExtensionToAdd is not immutable"); InitializeRemappedFrom(); remappedFrom.Add(extensionToAdd); } @@ -512,7 +513,7 @@ internal int CompareBaseNameTo(AssemblyNameExtension that) } int baselineResult = string.Compare(a1.Name, a2.Name, StringComparison.OrdinalIgnoreCase); - ErrorUtilities.VerifyThrow(result == baselineResult, "Optimized version of CompareBaseNameTo didn't return the same result as the baseline."); + FrameworkErrorUtilities.VerifyThrow(result == baselineResult, "Optimized version of CompareBaseNameTo didn't return the same result as the baseline."); #endif return result; } diff --git a/src/Shared/AssemblyNameReverseVersionComparer.cs b/src/Framework/Utilities/AssemblyNameReverseVersionComparer.cs similarity index 100% rename from src/Shared/AssemblyNameReverseVersionComparer.cs rename to src/Framework/Utilities/AssemblyNameReverseVersionComparer.cs diff --git a/src/Shared/CollectionHelpers.cs b/src/Framework/Utilities/CollectionHelpers.cs similarity index 100% rename from src/Shared/CollectionHelpers.cs rename to src/Framework/Utilities/CollectionHelpers.cs diff --git a/src/Shared/ConversionUtilities.cs b/src/Framework/Utilities/ConversionUtilities.cs similarity index 97% rename from src/Shared/ConversionUtilities.cs rename to src/Framework/Utilities/ConversionUtilities.cs index d04a52db675..b3bb1c300f2 100644 --- a/src/Shared/ConversionUtilities.cs +++ b/src/Framework/Utilities/ConversionUtilities.cs @@ -6,7 +6,7 @@ #if !NET using System.Text; #endif -using Error = Microsoft.Build.Shared.ErrorUtilities; +using Microsoft.Build.Framework; #nullable disable @@ -37,8 +37,7 @@ internal static bool ConvertStringToBool(string parameterValue) else { // Unsupported boolean representation. - Error.ThrowArgument("Shared.CannotConvertStringToBool", parameterValue); - return false; + throw new ArgumentException(SR.FormatCannotConvertStringToBool(parameterValue)); } } @@ -156,7 +155,7 @@ internal static double ConvertDecimalOrHexToDouble(string number) { return result; } - Error.ThrowInternalError("Cannot numeric evaluate"); + FrameworkErrorUtilities.ThrowInternalError("Cannot numeric evaluate"); return 0.0D; } diff --git a/src/Shared/EventArgsFormatting.cs b/src/Framework/Utilities/EventArgsFormatting.cs similarity index 98% rename from src/Shared/EventArgsFormatting.cs rename to src/Framework/Utilities/EventArgsFormatting.cs index 535ef4f4a4a..6008b9c405d 100644 --- a/src/Shared/EventArgsFormatting.cs +++ b/src/Framework/Utilities/EventArgsFormatting.cs @@ -69,7 +69,7 @@ internal static string FormatEventMessage(BuildMessageEventArgs e, bool showProj /// The formatted message string. internal static string FormatEventMessage(BuildErrorEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e); + ArgumentNullException.ThrowIfNull(e); // "error" should not be localized return FormatEventMessage("error", e.Subcategory, e.Message, @@ -86,7 +86,7 @@ internal static string FormatEventMessage(BuildErrorEventArgs e) /// The formatted message string. internal static string FormatEventMessage(BuildErrorEventArgs e, bool showProjectFile) { - ErrorUtilities.VerifyThrowArgumentNull(e); + ArgumentNullException.ThrowIfNull(e); // "error" should not be localized return FormatEventMessage("error", e.Subcategory, e.Message, @@ -102,7 +102,7 @@ internal static string FormatEventMessage(BuildErrorEventArgs e, bool showProjec /// The formatted message string. internal static string FormatEventMessage(BuildWarningEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e); + ArgumentNullException.ThrowIfNull(e); // "warning" should not be localized return FormatEventMessage("warning", e.Subcategory, e.Message, @@ -119,7 +119,7 @@ internal static string FormatEventMessage(BuildWarningEventArgs e) /// The formatted message string. internal static string FormatEventMessage(BuildWarningEventArgs e, bool showProjectFile) { - ErrorUtilities.VerifyThrowArgumentNull(e); + ArgumentNullException.ThrowIfNull(e); // "warning" should not be localized return FormatEventMessage("warning", e.Subcategory, e.Message, @@ -148,7 +148,7 @@ internal static string FormatEventMessage(BuildMessageEventArgs e) /// The formatted message string. internal static string FormatEventMessage(BuildMessageEventArgs e, bool showProjectFile, string nonNullMessage = null) { - ErrorUtilities.VerifyThrowArgumentNull(e); + ArgumentNullException.ThrowIfNull(e); // "message" should not be localized return FormatEventMessage("message", e.Subcategory, nonNullMessage ?? e.Message, diff --git a/src/Shared/FileDelegates.cs b/src/Framework/Utilities/FileDelegates.cs similarity index 99% rename from src/Shared/FileDelegates.cs rename to src/Framework/Utilities/FileDelegates.cs index e7ea596e2b3..3505c58d6a5 100644 --- a/src/Shared/FileDelegates.cs +++ b/src/Framework/Utilities/FileDelegates.cs @@ -3,7 +3,6 @@ using System.IO; - namespace Microsoft.Build.Shared { /// diff --git a/src/Shared/FileMatcher.cs b/src/Framework/Utilities/FileMatcher.cs similarity index 98% rename from src/Shared/FileMatcher.cs rename to src/Framework/Utilities/FileMatcher.cs index 584d0b955d9..b6411ec342e 100644 --- a/src/Shared/FileMatcher.cs +++ b/src/Framework/Utilities/FileMatcher.cs @@ -240,7 +240,7 @@ private static IReadOnlyList GetAccessibleFileSystemEntries(IFileSystem case FileSystemEntity.Directories: return GetAccessibleDirectories(fileSystem, path, pattern); case FileSystemEntity.FilesAndDirectories: return GetAccessibleFilesAndDirectories(fileSystem, path, pattern); default: - ErrorUtilities.ThrowInternalError("Unexpected filesystem entity type."); + FrameworkErrorUtilities.ThrowInternalError("Unexpected filesystem entity type."); break; } return []; @@ -458,8 +458,9 @@ internal static string GetLongPathName( return path; } - ErrorUtilities.VerifyThrow(!HasWildcards(path), - "GetLongPathName does not handle wildcards and was passed '{0}'.", path); + FrameworkErrorUtilities.VerifyThrow( + !HasWildcards(path), + $"GetLongPathName does not handle wildcards and was passed '{path}'."); string[] parts = path.Split(directorySeparatorCharacters); string pathRoot; @@ -524,9 +525,9 @@ internal static string GetLongPathName( } // Since we know there are no wild cards, this should be length one, i.e. MoveNext should return false. - ErrorUtilities.VerifyThrow(entries.Count == 1, - "Unexpected number of entries ({3}) found when enumerating '{0}' under '{1}'. Original path was '{2}'", - parts[i], longPath, path, entries.Count); + FrameworkErrorUtilities.VerifyThrow( + entries.Count == 1, + $"Unexpected number of entries ({entries.Count}) found when enumerating '{parts[i]}' under '{longPath}'. Original path was '{path}'"); // Entries[0] contains the full path. longPath = entries[0]; @@ -848,13 +849,15 @@ private void GetFilesRecursive( catch (UnauthorizedAccessException) { } #endif - ErrorUtilities.VerifyThrow((recursionState.SearchData.Filespec == null) || (recursionState.SearchData.RegexFileMatch == null), + FrameworkErrorUtilities.VerifyThrow( + (recursionState.SearchData.Filespec == null) || (recursionState.SearchData.RegexFileMatch == null), "File-spec overrides the regular expression -- pass null for file-spec if you want to use the regular expression."); - ErrorUtilities.VerifyThrow((recursionState.SearchData.Filespec != null) || (recursionState.SearchData.RegexFileMatch != null), + FrameworkErrorUtilities.VerifyThrow( + (recursionState.SearchData.Filespec != null) || (recursionState.SearchData.RegexFileMatch != null), "Need either a file-spec or a regular expression to match files."); - ErrorUtilities.VerifyThrow(recursionState.RemainingWildcardDirectory != null, "Expected non-null remaning wildcard directory."); + FrameworkErrorUtilities.VerifyThrow(recursionState.RemainingWildcardDirectory != null, "Expected non-null remaning wildcard directory."); RecursiveStepResult[] excludeNextSteps = null; // Determine if any of searchesToExclude is necessarily a superset of the results that will be returned. @@ -1057,7 +1060,7 @@ private IEnumerable GetFilesForStep( // it is case sensitive. If the flag is true and matching is handled with MatchFileRecursionStep, it is case-insensitive. // TODO: Can we fix this by using case-insensitive file I/O on Linux? string filespec; - if (NativeMethodsShared.IsLinux && recursionState.SearchData.DirectoryPattern != null) + if (NativeMethods.IsLinux && recursionState.SearchData.DirectoryPattern != null) { filespec = "*.*"; stepResult.NeedsToProcessEachFile = true; @@ -1190,7 +1193,7 @@ internal static string RegularExpressionFromFileSpec( string filenamePart) { #if DEBUG - ErrorUtilities.VerifyThrow( + FrameworkErrorUtilities.VerifyThrow( FileSpecRegexMinLength == FileSpecRegexParts.BeginningOfLine.Length + FileSpecRegexParts.WildcardGroupStart.Length + FileSpecRegexParts.FilenameGroupStart.Length @@ -1198,7 +1201,7 @@ internal static string RegularExpressionFromFileSpec( + FileSpecRegexParts.EndOfLine.Length, "Checked-in length of known regex components differs from computed length. Update checked-in constant."); #endif - using (var matchFileExpression = new ReuseableStringBuilder(FileSpecRegexMinLength + NativeMethodsShared.MAX_PATH)) + using (var matchFileExpression = new ReuseableStringBuilder(FileSpecRegexMinLength + NativeMethods.MAX_PATH)) { AppendRegularExpressionFromFixedDirectory(matchFileExpression, fixedDirectoryPart); AppendRegularExpressionFromWildcardDirectory(matchFileExpression, wildcardDirectoryPart); @@ -1251,7 +1254,7 @@ private static void AppendRegularExpressionFromFixedDirectory(ReuseableStringBui { regex.Append(FileSpecRegexParts.BeginningOfLine); - bool isUncPath = NativeMethodsShared.IsWindows && fixedDir.Length > 1 + bool isUncPath = NativeMethods.IsWindows && fixedDir.Length > 1 && fixedDir[0] == '\\' && fixedDir[1] == '\\'; if (isUncPath) { @@ -1687,7 +1690,7 @@ internal static bool IsMatch(ReadOnlySpan input, string pattern) { if (input == ReadOnlySpan.Empty) { - ErrorUtilities.ThrowInternalError("Unexpected empty 'input' provided."); + FrameworkErrorUtilities.ThrowInternalError("Unexpected empty 'input' provided."); } if (pattern == null) { @@ -2267,7 +2270,7 @@ internal static bool IsDriveEnumeratingWildcardPattern(string directoryPart, str int wildcardPartLength = wildcardPart.Length; // Handles detection of :** pattern for Windows. - if (NativeMethodsShared.IsWindows && + if (NativeMethods.IsWindows && directoryPartLength >= 3 && wildcardPartLength >= 2 && IsDrivePatternWithoutSlash(directoryPart[0], directoryPart[1])) @@ -2589,7 +2592,7 @@ private static string[] CreateArrayWithSingleItemIfNotExcluded(string filespecUn // Set to use only half processors when we have 4 or more of them, in order to not be too aggresive // By setting MaxTasksPerIteration to the maximum amount of tasks, which means that only one // Parallel.ForEach will run at once, we get a stable number of threads being created. - var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2); + var maxTasks = Math.Max(1, NativeMethods.GetLogicalCoreCount() / 2); var taskOptions = new TaskOptions(maxTasks) { AvailableTasks = maxTasks, @@ -2614,7 +2617,7 @@ private static string[] CreateArrayWithSingleItemIfNotExcluded(string filespecUn CreateArrayWithSingleItemIfNotExcluded(filespecUnescaped, excludeSpecsUnescaped), trackSearchAction, trackExcludeFileSpec, - ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("Shared.GlobExpansionFailed", filespecUnescaped, ex.ToString())); + SR.FormatGlobExpansionFailed(filespecUnescaped, ex.ToString())); } throw; @@ -2626,7 +2629,7 @@ private static string[] CreateArrayWithSingleItemIfNotExcluded(string filespecUn CreateArrayWithSingleItemIfNotExcluded(filespecUnescaped, excludeSpecsUnescaped), trackSearchAction, trackExcludeFileSpec, - ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("Shared.GlobExpansionFailed", filespecUnescaped, ex.ToString())); + SR.FormatGlobExpansionFailed(filespecUnescaped, ex.ToString())); } /* diff --git a/src/Shared/FrameworkLocationHelper.cs b/src/Framework/Utilities/FrameworkLocationHelper.cs similarity index 94% rename from src/Shared/FrameworkLocationHelper.cs rename to src/Framework/Utilities/FrameworkLocationHelper.cs index 9945522ae59..1f6d047d4c9 100644 --- a/src/Shared/FrameworkLocationHelper.cs +++ b/src/Framework/Utilities/FrameworkLocationHelper.cs @@ -90,16 +90,16 @@ internal static class FrameworkLocationHelper private const string referenceAssembliesRegistryValueName = "All Assemblies In"; #endif // FEATURE_WIN32_REGISTRY internal const string dotNetFrameworkSdkInstallKeyValueV11 = "SDKInstallRootv1.1"; - internal static string dotNetFrameworkVersionFolderPrefixV11 = NativeMethodsShared.IsWindows ? "v1.1" : "1.1"; // v1.1 is for Everett. - private const string dotNetFrameworkVersionV11 = "v1.1.4322"; // full Everett version to pass to NativeMethodsShared.GetRequestedRuntimeInfo(). + internal static string dotNetFrameworkVersionFolderPrefixV11 = NativeMethods.IsWindows ? "v1.1" : "1.1"; // v1.1 is for Everett. + private const string dotNetFrameworkVersionV11 = "v1.1.4322"; // full Everett version to pass to NativeMethods.GetRequestedRuntimeInfo(). private const string dotNetFrameworkRegistryKeyV11 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionV11; internal const string dotNetFrameworkSdkInstallKeyValueV20 = "SDKInstallRootv2.0"; - internal static string dotNetFrameworkVersionFolderPrefixV20 = NativeMethodsShared.IsWindows ? "v2.0" : "2.0"; // v2.0 is for Whidbey. - private const string dotNetFrameworkVersionV20 = "v2.0.50727"; // full Whidbey version to pass to NativeMethodsShared.GetRequestedRuntimeInfo(). + internal static string dotNetFrameworkVersionFolderPrefixV20 = NativeMethods.IsWindows ? "v2.0" : "2.0"; // v2.0 is for Whidbey. + private const string dotNetFrameworkVersionV20 = "v2.0.50727"; // full Whidbey version to pass to NativeMethods.GetRequestedRuntimeInfo(). private const string dotNetFrameworkRegistryKeyV20 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionV20; - internal static string dotNetFrameworkVersionFolderPrefixV30 = NativeMethodsShared.IsWindows ? "v3.0" : "3.0"; // v3.0 is for WinFx. + internal static string dotNetFrameworkVersionFolderPrefixV30 = NativeMethods.IsWindows ? "v3.0" : "3.0"; // v3.0 is for WinFx. private static readonly string s_dotNetFrameworkRegistryKeyV30 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionFolderPrefixV30 + "\\Setup"; #if FEATURE_WIN32_REGISTRY @@ -113,14 +113,14 @@ internal static class FrameworkLocationHelper private const string dotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86"; private const string fullDotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A = "HKEY_LOCAL_MACHINE\\" + dotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A; - internal static string dotNetFrameworkVersionFolderPrefixV35 = NativeMethodsShared.IsWindows ? "v3.5" : "3.5"; // v3.5 is for Orcas. + internal static string dotNetFrameworkVersionFolderPrefixV35 = NativeMethods.IsWindows ? "v3.5" : "3.5"; // v3.5 is for Orcas. private static readonly string s_dotNetFrameworkRegistryKeyV35 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionFolderPrefixV35; internal const string fullDotNetFrameworkSdkRegistryKeyV35OnVS10 = fullDotNetFrameworkSdkRegistryPathForV35ToolsOnWinSDK70A; internal const string fullDotNetFrameworkSdkRegistryKeyV35OnVS11 = fullDotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A; - internal static string dotNetFrameworkVersionFolderPrefixV40 = NativeMethodsShared.IsWindows ? "v4.0" : "4.0"; - internal static string dotNetFrameworkVersionFolderPrefixV45 = NativeMethodsShared.IsWindows ? "v4.5" : "4.5"; + internal static string dotNetFrameworkVersionFolderPrefixV40 = NativeMethods.IsWindows ? "v4.0" : "4.0"; + internal static string dotNetFrameworkVersionFolderPrefixV45 = NativeMethods.IsWindows ? "v4.5" : "4.5"; #if FEATURE_WIN32_REGISTRY /// @@ -441,8 +441,8 @@ internal static string PathToDotNetFrameworkV11 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) : GetPathToDotNetFrameworkV11(DotNetFrameworkArchitecture.Current); } } @@ -451,8 +451,8 @@ internal static string PathToDotNetFrameworkV20 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) : GetPathToDotNetFrameworkV20(DotNetFrameworkArchitecture.Current); } } @@ -461,8 +461,8 @@ internal static string PathToDotNetFrameworkV30 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV30) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV30) : GetPathToDotNetFrameworkV30(DotNetFrameworkArchitecture.Current); } } @@ -471,8 +471,8 @@ internal static string PathToDotNetFrameworkV35 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV35) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV35) : GetPathToDotNetFrameworkV35(DotNetFrameworkArchitecture.Current); } } @@ -481,8 +481,8 @@ internal static string PathToDotNetFrameworkV40 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV40) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV40) : GetPathToDotNetFrameworkV40(DotNetFrameworkArchitecture.Current); } } @@ -491,8 +491,8 @@ internal static string PathToDotNetFrameworkV45 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV45) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV45) : GetPathToDotNetFrameworkV45(DotNetFrameworkArchitecture.Current); } } @@ -501,8 +501,8 @@ internal static string PathToDotNetFrameworkSdkV11 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) : GetPathToDotNetFrameworkSdkTools(dotNetFrameworkVersion11, visualStudioVersionLatest); } } @@ -511,8 +511,8 @@ internal static string PathToDotNetFrameworkSdkV20 { get { - return NativeMethodsShared.IsUnixLike - ? Path.Combine(NativeMethodsShared.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) + return NativeMethods.IsUnixLike + ? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) : GetPathToDotNetFrameworkSdkTools(dotNetFrameworkVersion20, visualStudioVersionLatest); } } @@ -535,9 +535,9 @@ private static string FallbackDotNetFrameworkSdkInstallPath if (s_fallbackDotNetFrameworkSdkInstallPath == null) { // For non-Windows just get the current Framework path - if (!NativeMethodsShared.IsWindows) + if (!NativeMethods.IsWindows) { - s_fallbackDotNetFrameworkSdkInstallPath = NativeMethodsShared.FrameworkCurrentPath; + s_fallbackDotNetFrameworkSdkInstallPath = NativeMethods.FrameworkCurrentPath; } #if FEATURE_WIN32_REGISTRY else @@ -585,7 +585,7 @@ private static string PathToV35ToolsInFallbackDotNetFrameworkSdk { if (FallbackDotNetFrameworkSdkInstallPath != null) { - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { var endsWithASlash = FallbackDotNetFrameworkSdkInstallPath.EndsWith( @@ -632,7 +632,7 @@ private static string PathToV4ToolsInFallbackDotNetFrameworkSdk { if (FallbackDotNetFrameworkSdkInstallPath != null) { - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { bool endsWithASlash = FallbackDotNetFrameworkSdkInstallPath.EndsWith( "\\", @@ -667,7 +667,12 @@ internal static string GetDotNetFrameworkSdkRootRegistryKey(Version dotNetFramew var dotNetFrameworkSpec = GetDotNetFrameworkSpec(dotNetFrameworkVersion); var visualStudioSpec = GetVisualStudioSpec(visualStudioVersion); - ErrorUtilities.VerifyThrowArgument(visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion), "FrameworkLocationHelper.UnsupportedFrameworkVersion", dotNetFrameworkVersion); + + if (!visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion)) + { + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersion(dotNetFrameworkVersion)); + } + return dotNetFrameworkSpec.GetDotNetFrameworkSdkRootRegistryKey(visualStudioSpec); } @@ -677,7 +682,12 @@ internal static string GetDotNetFrameworkSdkInstallKeyValue(Version dotNetFramew var dotNetFrameworkSpec = GetDotNetFrameworkSpec(dotNetFrameworkVersion); var visualStudioSpec = GetVisualStudioSpec(visualStudioVersion); - ErrorUtilities.VerifyThrowArgument(visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion), "FrameworkLocationHelper.UnsupportedFrameworkVersion", dotNetFrameworkVersion); + + if (!visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion)) + { + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersion(dotNetFrameworkVersion)); + } + return dotNetFrameworkSpec.DotNetFrameworkSdkRegistryInstallationFolderName; } @@ -702,7 +712,12 @@ internal static string GetPathToDotNetFrameworkSdkTools(Version dotNetFrameworkV var dotNetFrameworkSpec = GetDotNetFrameworkSpec(dotNetFrameworkVersion); var visualStudioSpec = GetVisualStudioSpec(visualStudioVersion); - ErrorUtilities.VerifyThrowArgument(visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion), "FrameworkLocationHelper.UnsupportedFrameworkVersion", dotNetFrameworkVersion); + + if (!visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion)) + { + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersion(dotNetFrameworkVersion)); + } + return dotNetFrameworkSpec.GetPathToDotNetFrameworkSdkTools(visualStudioSpec); } @@ -712,7 +727,12 @@ internal static string GetPathToDotNetFrameworkSdk(Version dotNetFrameworkVersio var dotNetFrameworkSpec = GetDotNetFrameworkSpec(dotNetFrameworkVersion); var visualStudioSpec = GetVisualStudioSpec(visualStudioVersion); - ErrorUtilities.VerifyThrowArgument(visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion), "FrameworkLocationHelper.UnsupportedFrameworkVersion", dotNetFrameworkVersion); + + if (!visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion)) + { + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersion(dotNetFrameworkVersion)); + } + return dotNetFrameworkSpec.GetPathToDotNetFrameworkSdk(visualStudioSpec); } @@ -773,7 +793,7 @@ private static bool CheckForFrameworkInstallation(string registryEntryToCheckIns // If complus is set then we will return that directory as the framework directory, there is no need to check the registry value for the framework and it may not even be installed. if (String.IsNullOrEmpty(complusInstallRoot) && String.IsNullOrEmpty(complusVersion)) { - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { // If the registry entry is 1 then the framework is installed. Go ahead and find the directory. If it is not 1 then the framework is not installed, return null. return String.Equals("1", FindRegistryValueUnderKey(registryEntryToCheckInstall, registryValueToCheckInstall), StringComparison.OrdinalIgnoreCase); @@ -806,14 +826,14 @@ internal static string FindDotNetFrameworkPath( GetDirectories getDirectories, DotNetFrameworkArchitecture architecture) { - if (!NativeMethodsShared.IsWindows) + if (!NativeMethods.IsWindows) { if (!string.IsNullOrEmpty(prefix) && prefix[0] is 'v' or 'V') { prefix = prefix.Substring(1); } - var frameworkPath = Path.Combine(NativeMethodsShared.FrameworkBasePath, prefix ?? string.Empty); + var frameworkPath = Path.Combine(NativeMethods.FrameworkBasePath, prefix ?? string.Empty); return directoryExists(frameworkPath) ? frameworkPath : null; } @@ -963,9 +983,9 @@ internal static string GenerateProgramFilesReferenceAssemblyRoot() } } - combinedPath = NativeMethodsShared.IsWindows + combinedPath = NativeMethods.IsWindows ? Path.Combine(programFiles32, "Reference Assemblies\\Microsoft\\Framework") - : Path.Combine(NativeMethodsShared.FrameworkBasePath, "xbuild-frameworks"); + : Path.Combine(NativeMethods.FrameworkBasePath, "xbuild-frameworks"); return Path.GetFullPath(combinedPath); } @@ -1010,8 +1030,8 @@ internal static string GeneratePathToBuildToolsForToolsVersion(string toolsVersi /// The path to the reference assembly location internal static string GenerateReferenceAssemblyPath(string targetFrameworkRootPath, FrameworkName frameworkName) { - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkRootPath); - ErrorUtilities.VerifyThrowArgumentNull(frameworkName); + ArgumentNullException.ThrowIfNull(targetFrameworkRootPath); + ArgumentNullException.ThrowIfNull(frameworkName); try { @@ -1025,9 +1045,7 @@ internal static string GenerateReferenceAssemblyPath(string targetFrameworkRootP } catch (Exception e) when (ExceptionHandling.IsIoRelatedException(e)) { - ErrorUtilities.ThrowInvalidOperation("FrameworkLocationHelper.CouldNotGenerateReferenceAssemblyDirectory", targetFrameworkRootPath, frameworkName.ToString(), e.Message); - // The compiler does not see the massage above an as exception; - return null; + throw new InvalidOperationException(SR.FormatCouldNotGenerateReferenceAssemblyDirectory(targetFrameworkRootPath, frameworkName.ToString(), e.Message)); } } @@ -1039,7 +1057,7 @@ internal static string GenerateReferenceAssemblyPath(string targetFrameworkRootP /// internal static string RemoveDirectories(string path, int numberOfLevelsToRemove) { - ErrorUtilities.VerifyThrowArgumentOutOfRange(numberOfLevelsToRemove > 0, nameof(numberOfLevelsToRemove)); + ArgumentOutOfRangeException.ThrowIfNegativeOrZero(numberOfLevelsToRemove); string fixedPath = null; if (path != null) @@ -1153,16 +1171,14 @@ private static string FindRegistryValueUnderKey( #endif private static VisualStudioSpec GetVisualStudioSpec(Version version) - { - ErrorUtilities.VerifyThrowArgument(VisualStudioSpecDict.Value.TryGetValue(version, out VisualStudioSpec spec), "FrameworkLocationHelper.UnsupportedVisualStudioVersion", version); - return spec; - } + => VisualStudioSpecDict.Value.TryGetValue(version, out VisualStudioSpec spec) + ? spec + : throw new ArgumentException(SR.FormatUnsupportedVisualStudioVersion(version)); private static DotNetFrameworkSpec GetDotNetFrameworkSpec(Version version) - { - ErrorUtilities.VerifyThrowArgument(DotNetFrameworkSpecDict.Value.TryGetValue(version, out DotNetFrameworkSpec spec), "FrameworkLocationHelper.UnsupportedFrameworkVersion", version); - return spec; - } + => DotNetFrameworkSpecDict.Value.TryGetValue(version, out DotNetFrameworkSpec spec) + ? spec + : throw new ArgumentException(SR.FormatUnsupportedFrameworkVersion(version)); /// /// Helper method to create an instance of for .net v4.x, @@ -1177,7 +1193,7 @@ private static DotNetFrameworkSpec CreateDotNetFrameworkSpecForV4(Version versio version, dotNetFrameworkRegistryKey: dotNetFrameworkSetupRegistryPath + "\\v4\\Full", dotNetFrameworkSetupRegistryInstalledName: "Install", - dotNetFrameworkVersionFolderPrefix: NativeMethodsShared.IsWindows ? "v4.0" : "v4.5", + dotNetFrameworkVersionFolderPrefix: NativeMethods.IsWindows ? "v4.0" : "v4.5", dotNetFrameworkSdkRegistryToolsKey: "WinSDK-NetFx40Tools-x86", dotNetFrameworkSdkRegistryInstallationFolderName: "InstallationFolder", hasMSBuild: true, @@ -1411,7 +1427,7 @@ public virtual string GetPathToDotNetFramework(DotNetFrameworkArchitecture archi #if FEATURE_WIN32_REGISTRY // Otherwise, check to see if we're even installed. If not, return null -- no point in setting the static // variables to null when that's what they are already. - if (NativeMethodsShared.IsWindows && !CheckForFrameworkInstallation( + if (NativeMethods.IsWindows && !CheckForFrameworkInstallation( this._dotNetFrameworkRegistryKey, this._dotNetFrameworkSetupRegistryInstalledName)) { @@ -1462,9 +1478,9 @@ public virtual string GetPathToDotNetFrameworkSdkTools(VisualStudioSpec visualSt string generatedPathToDotNetFrameworkSdkTools = null; - if (NativeMethodsShared.IsUnixLike) + if (NativeMethods.IsUnixLike) { - string frameworkPath = NativeMethodsShared.FrameworkBasePath; + string frameworkPath = NativeMethods.FrameworkBasePath; if (!string.IsNullOrEmpty(frameworkPath)) { frameworkPath = Path.Combine(frameworkPath, this.Version.ToString()); @@ -1553,7 +1569,7 @@ public virtual string GetPathToDotNetFrameworkSdkTools(VisualStudioSpec visualSt public virtual string GetPathToDotNetFrameworkSdk(VisualStudioSpec visualStudioSpec) { string pathToBinRoot = this.GetPathToDotNetFrameworkSdkTools(visualStudioSpec); - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { pathToBinRoot = RemoveDirectories(pathToBinRoot, 2); } @@ -1590,13 +1606,16 @@ public virtual string GetPathToWindowsSdk() #if FEATURE_WIN32_REGISTRY if (this._pathToWindowsSdk == null) { - ErrorUtilities.VerifyThrowArgument(this._visualStudioVersion != null, "FrameworkLocationHelper.UnsupportedFrameworkVersionForWindowsSdk", this.Version); + if (_visualStudioVersion == null) + { + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersionForWindowsSdk(Version)); + } - var visualStudioSpec = GetVisualStudioSpec(this._visualStudioVersion); + var visualStudioSpec = GetVisualStudioSpec(_visualStudioVersion); if (string.IsNullOrEmpty(visualStudioSpec.WindowsSdkRegistryKey) || string.IsNullOrEmpty(visualStudioSpec.WindowsSdkRegistryInstallationFolderName)) { - ErrorUtilities.ThrowArgument("FrameworkLocationHelper.UnsupportedFrameworkVersionForWindowsSdk", this.Version); + throw new ArgumentException(SR.FormatUnsupportedFrameworkVersionForWindowsSdk(Version)); } string registryPath = string.Join(@"\", MicrosoftSDKsRegistryKey, "Windows", visualStudioSpec.WindowsSdkRegistryKey); diff --git a/src/Shared/MetadataConversionUtilities.cs b/src/Framework/Utilities/MetadataConversionUtilities.cs similarity index 92% rename from src/Shared/MetadataConversionUtilities.cs rename to src/Framework/Utilities/MetadataConversionUtilities.cs index d83d2511cc9..6ff584aa8f5 100644 --- a/src/Shared/MetadataConversionUtilities.cs +++ b/src/Framework/Utilities/MetadataConversionUtilities.cs @@ -4,7 +4,6 @@ using System; using Microsoft.Build.Framework; - namespace Microsoft.Build.Shared { /// @@ -42,7 +41,7 @@ internal static bool TryConvertItemMetadataToBool( } catch (System.ArgumentException e) { - throw new ArgumentException(ResourceUtilities.FormatResourceStringStripCodeAndKeyword("General.InvalidAttributeMetadata", item.ItemSpec, itemMetadataName, metadataValue, "bool"), e); + throw new ArgumentException(SR.FormatInvalidAttributeMetadata(item.ItemSpec, itemMetadataName, metadataValue, "bool"), e); } } diff --git a/src/Shared/ProcessExtensions.cs b/src/Framework/Utilities/ProcessExtensions.cs similarity index 98% rename from src/Shared/ProcessExtensions.cs rename to src/Framework/Utilities/ProcessExtensions.cs index c6e88319eb3..15a9e592f91 100644 --- a/src/Shared/ProcessExtensions.cs +++ b/src/Framework/Utilities/ProcessExtensions.cs @@ -3,13 +3,14 @@ using System; using System.Diagnostics; +using Microsoft.Build.Framework; #if NET -using System.Runtime.Versioning; -using System.Runtime.InteropServices; using System.Buffers; -using System.Text; using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using System.Text; #endif namespace Microsoft.Build.Shared @@ -21,11 +22,11 @@ public static void KillTree(this Process process, int timeoutMilliseconds) #if NET process.Kill(entireProcessTree: true); #else - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { try { - NativeMethodsShared.KillTree(process.Id); + NativeMethods.KillTree(process.Id); } catch (InvalidOperationException) { @@ -62,17 +63,17 @@ public static bool TryGetCommandLine(this Process? process, out string? commandL try { #if NET - if (NativeMethodsShared.IsWindows) + if (NativeMethods.IsWindows) { commandLine = Windows.GetCommandLine(process.Id); return true; } - else if (NativeMethodsShared.IsOSX || NativeMethodsShared.IsBSD) + else if (NativeMethods.IsOSX || NativeMethods.IsBSD) { commandLine = BSD.GetCommandLine(process.Id); return true; } - else if (NativeMethodsShared.IsLinux) + else if (NativeMethods.IsLinux) { commandLine = Linux.GetCommandLine(process.Id); return true; @@ -131,7 +132,7 @@ private static string ParseNullSeparatedArguments(ReadOnlySpan data, int m // Decode UTF-8 directly into the char buffer int charsWritten = Encoding.UTF8.GetChars(segment, charBuffer.AsSpan(totalChars)); - + // UTF-8 decoder converts null bytes to null chars - replace them with spaces for safety Span decodedChars = charBuffer.AsSpan(totalChars, charsWritten); for (int i = 0; i < decodedChars.Length; i++) @@ -182,7 +183,7 @@ private static class Windows private const int WBEM_FLAG_RETURN_IMMEDIATELY = 0x00000010; private const int WBEM_INFINITE = -1; - + // RPC authentication/impersonation constants (used by CoInitializeSecurity and CoSetProxyBlanket) private const int RPC_C_AUTHN_LEVEL_DEFAULT = 0; private const int RPC_C_AUTHN_LEVEL_CALL = 3; diff --git a/src/Shared/QuotingUtilities.cs b/src/Framework/Utilities/QuotingUtilities.cs similarity index 96% rename from src/Shared/QuotingUtilities.cs rename to src/Framework/Utilities/QuotingUtilities.cs index 63f7ad4be00..352f885e729 100644 --- a/src/Shared/QuotingUtilities.cs +++ b/src/Framework/Utilities/QuotingUtilities.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text; - +using Microsoft.Build.Framework; namespace Microsoft.Build.Shared { @@ -67,11 +67,11 @@ internal static List SplitUnquoted( out int emptySplits, params char[] separator) { - ErrorUtilities.VerifyThrow(maxSplits >= 2, "There is no point calling this method for less than two splits."); + FrameworkErrorUtilities.VerifyThrow(maxSplits >= 2, "There is no point calling this method for less than two splits."); string separators = new StringBuilder().Append(separator).ToString(); - ErrorUtilities.VerifyThrow(separators.IndexOf('"') == -1, "The double-quote character is not supported as a separator."); + FrameworkErrorUtilities.VerifyThrow(separators.IndexOf('"') == -1, "The double-quote character is not supported as a separator."); StringBuilder splitString = new StringBuilder(); splitString.EnsureCapacity(input.Length); diff --git a/src/Shared/StringUtils.cs b/src/Framework/Utilities/StringUtils.cs similarity index 100% rename from src/Shared/StringUtils.cs rename to src/Framework/Utilities/StringUtils.cs diff --git a/src/Shared/TaskFactoryUtilities.cs b/src/Framework/Utilities/TaskFactoryUtilities.cs similarity index 100% rename from src/Shared/TaskFactoryUtilities.cs rename to src/Framework/Utilities/TaskFactoryUtilities.cs diff --git a/src/Shared/ThreadPoolExtensions.cs b/src/Framework/Utilities/ThreadPoolExtensions.cs similarity index 100% rename from src/Shared/ThreadPoolExtensions.cs rename to src/Framework/Utilities/ThreadPoolExtensions.cs diff --git a/src/Framework/Utilities/TypeExtensions.cs b/src/Framework/Utilities/TypeExtensions.cs new file mode 100644 index 00000000000..b4a705ae15a --- /dev/null +++ b/src/Framework/Utilities/TypeExtensions.cs @@ -0,0 +1,13 @@ +// 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; + +namespace Microsoft.Build.Shared; + +internal static class TypeExtensions +{ + public static string GetAssemblyPath(this Type type) + => Path.GetFullPath(AssemblyUtilities.GetAssemblyLocation(type.Assembly)); +} diff --git a/src/Shared/TypeUtilities.cs b/src/Framework/Utilities/TypeUtilities.cs similarity index 100% rename from src/Shared/TypeUtilities.cs rename to src/Framework/Utilities/TypeUtilities.cs diff --git a/src/Shared/VersionUtilities.cs b/src/Framework/Utilities/VersionUtilities.cs similarity index 100% rename from src/Shared/VersionUtilities.cs rename to src/Framework/Utilities/VersionUtilities.cs diff --git a/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj b/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj index 378a9068711..c6926ff83b0 100644 --- a/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj +++ b/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj @@ -1,4 +1,4 @@ - + $(RuntimeOutputTargetFrameworks) @@ -32,13 +32,9 @@ RegistryDelegates.cs - RegistryHelper.cs - - VersionUtilities.cs - Microsoft.Build.Core.xsd diff --git a/src/MSBuild/CommandLine/CommandLineParser.cs b/src/MSBuild/CommandLine/CommandLineParser.cs index 69ba921f643..59512cec8e8 100644 --- a/src/MSBuild/CommandLine/CommandLineParser.cs +++ b/src/MSBuild/CommandLine/CommandLineParser.cs @@ -62,7 +62,7 @@ internal class CommandLineParser /// public CommandLineSwitchesAccessor Parse(IEnumerable commandLineArgs) { - List args = [BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, ..commandLineArgs]; + List args = [BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, .. commandLineArgs]; List deferredBuildMessages = []; GatherAllSwitches( @@ -117,7 +117,7 @@ internal void GatherAllSwitches( switchesFromAutoResponseFile = new CommandLineSwitches(); if (!switchesNotFromAutoResponseFile[ParameterlessSwitch.NoAutoResponse]) { - string exePath = Path.GetDirectoryName(BuildEnvironmentHelper.ExecutingAssemblyPath); // Copied from XMake + string exePath = Path.GetDirectoryName(typeof(MSBuildApp).GetAssemblyPath()); // Copied from XMake GatherAutoResponseFileSwitches(exePath, switchesFromAutoResponseFile, fullCommandLine); } @@ -532,7 +532,7 @@ internal bool CheckAndGatherProjectAutoResponseFile(CommandLineSwitches switches found = !string.IsNullOrWhiteSpace(directoryResponseFile) && GatherAutoResponseFileSwitchesFromFullPath(directoryResponseFile, switchesFromAutoResponseFile, commandLine); // Don't look for more response files if it's only in the same place we already looked (next to the exe) - string exePath = Path.GetDirectoryName(BuildEnvironmentHelper.ExecutingAssemblyPath); // Copied from XMake + string exePath = Path.GetDirectoryName(typeof(MSBuildApp).GetAssemblyPath()); // Copied from XMake if (!string.Equals(projectDirectory, exePath, StringComparison.OrdinalIgnoreCase)) { // this combines any found, with higher precedence, with the switches from the original auto response file switches diff --git a/src/MSBuild/MSBuild.csproj b/src/MSBuild/MSBuild.csproj index 6047716de27..979f4f625a2 100644 --- a/src/MSBuild/MSBuild.csproj +++ b/src/MSBuild/MSBuild.csproj @@ -55,34 +55,13 @@ - - Shared\FrameworkLocationHelper.cs - - - BuildEnvironmentHelper.cs - - - AssemblyNameComparer.cs - - - - FileDelegates.cs - - - RegisteredTaskObjectCacheBase.cs - - - - - - @@ -92,10 +71,7 @@ - - - @@ -106,27 +82,19 @@ - - - - - - - - diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index c383c72705d..60720e1d842 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -160,7 +160,7 @@ static MSBuildApp() // This forces the type to initialize in this static constructor and thus // // any configuration file exceptions can be caught here. // //////////////////////////////////////////////////////////////////////////////// - s_exePath = Path.GetDirectoryName(BuildEnvironmentHelper.ExecutingAssemblyPath); + s_exePath = Path.GetDirectoryName(typeof(MSBuildApp).GetAssemblyPath()); commandLineParser = new CommandLineParser(); s_initialized = true; diff --git a/src/Shared/Debugging/DebugUtils.cs b/src/Shared/Debugging/DebugUtils.cs index 3c6788f9f7f..39d08989e7f 100644 --- a/src/Shared/Debugging/DebugUtils.cs +++ b/src/Shared/Debugging/DebugUtils.cs @@ -94,12 +94,9 @@ internal static void UnhandledExceptionHandler(object sender, UnhandledException { Exception ex = (Exception)e.ExceptionObject; DumpExceptionToFile(ex); -#if !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS RecordCrashTelemetryForUnhandledException(ex); -#endif } -#if !MICROSOFT_BUILD_ENGINE_OM_UNITTESTS /// /// Records and immediately flushes crash telemetry for an unhandled exception. /// Best effort - must never throw, as the process is already crashing. @@ -113,7 +110,6 @@ private static void RecordCrashTelemetryForUnhandledException(Exception ex) isUnhandled: true, isCritical: ExceptionHandling.IsCriticalException(ex)); } -#endif /// /// Dump the exception information to a file diff --git a/src/Shared/Debugging/PrintLineDebuggerWriters.cs b/src/Shared/Debugging/PrintLineDebuggerWriters.cs index 5f97665568f..e5318d122f6 100644 --- a/src/Shared/Debugging/PrintLineDebuggerWriters.cs +++ b/src/Shared/Debugging/PrintLineDebuggerWriters.cs @@ -71,7 +71,7 @@ public CompositeWriter(IEnumerable writers) private static readonly Lazy _artifactsLogs = new Lazy( () => { - var executingAssembly = BuildEnvironmentHelper.ExecutingAssemblyPath; + var executingAssembly = typeof(PrintLineDebuggerWriters).GetAssemblyPath(); var binPart = $"bin"; diff --git a/src/Shared/XamlUtilities.cs b/src/Shared/XamlUtilities.cs deleted file mode 100644 index aac45a9a515..00000000000 --- a/src/Shared/XamlUtilities.cs +++ /dev/null @@ -1,432 +0,0 @@ -using System; -using System.Xml; -using System.Text.RegularExpressions; -using Microsoft.Build.Construction; -using Microsoft.Build.Framework.XamlTypes; - - -namespace Microsoft.Build.Shared -{ - /// - /// This class contains utility methods for Xaml types. - /// - static internal class XamlUtilities - { - /// - /// Gets an identifier for a property based on its name, its containing object's name and/or type. This is intended to - /// help the user zero in on the offending line/element in a xaml file, when we don't have access to a parser to - /// report line numbers. - /// - /// The name of the property. - /// The name of the containing object. - /// The object which contains this property. - /// Returns "(containingObject's type name)containingObjectName.PropertyName". - internal static string GetPropertyId(string propertyName, string containingObjectName, object containingObject) - { - ErrorUtilities.VerifyThrowArgumentLength(propertyName, "propertyName"); - ErrorUtilities.VerifyThrowArgumentLength(containingObjectName, "containingObjectName"); - ErrorUtilities.VerifyThrowArgumentNull(containingObject, "containingObject"); - - StringBuilder propertyId = new StringBuilder(); - - propertyId.Append("("); - propertyId.Append(containingObject.GetType().Name); - propertyId.Append(")"); - - if (!string.IsNullOrEmpty(containingObjectName)) - { - propertyId.Append(containingObjectName); - } - - propertyId.Append("."); - - propertyId.Append(propertyName); - - return propertyId.ToString(); - } - - /// - /// Returns an identifier for a property based on its name and its containing object's type. Use this - /// overload when the containing object's name is not known (which can be the case when the property - /// being tested is the Name property itself). - /// - /// The name of the property. - /// The object which contains this property. - /// Returns "(containingObject's type name)unknown.PropertyName". - internal static string GetPropertyId(string propertyName, object containingObject) - { - string propertyId = GetPropertyId(propertyName, "unknown", containingObject); - return propertyId; - } - - /// - /// Throws an if the given property is null. - /// - /// The property to test. - /// An identifier of the property to check. - internal static void VerifyThrowPropertyNotSet(object property, string propertyId) - { - ErrorUtilities.VerifyThrowArgumentLength(propertyId, "propertyId"); - - if (property == null) - { - ErrorUtilities.VerifyThrowArgumentNull(null, propertyId, Strings.PropertyValueMustBeSet); - } - } - - /// - /// Throws an if the given property is null. - /// - /// The property to test. - /// An identifier of the property to check. - /// The text message to display. - internal static void VerifyThrowPropertyNotSet(object property, string propertyId, string unformattedMessage) - { - ErrorUtilities.VerifyThrowArgumentLength(propertyId, "propertyId"); - - if (property == null) - { - ErrorUtilities.VerifyThrowArgumentNull(null, propertyId, unformattedMessage); - } - } - - /// - /// Throws an if the given property's value is the empty string. - /// - /// The parameter to test. - /// An identifier of the property to check. - internal static void VerifyThrowPropertyEmptyString(string property, string propertyId) - { - ErrorUtilities.VerifyThrowArgumentNull(property, "property"); - ErrorUtilities.VerifyThrowArgumentLength(propertyId, "propertyId"); - - if (property.Length == 0) - { - ErrorUtilities.ThrowArgument(Strings.PropertyCannotBeSetToTheEmptyString, propertyId); - } - } - - /// - /// Throws an if the given property is null and - /// if the given property's value is the empty string. - /// - /// The parameter to test. - /// An identifier of the property to check. - internal static void VerifyThrowPropertyNotSetOrEmptyString(string property, string propertyId) - { - VerifyThrowPropertyNotSet(property, propertyId); - VerifyThrowPropertyEmptyString(property, propertyId); - } - - /// - /// Throws an if the given list property has zero elements. - /// - /// The list parameter to test. - /// An identifier of the property to check. - internal static void VerifyThrowListPropertyEmpty(IList listProperty, string propertyId) - { - ErrorUtilities.VerifyThrowArgumentNull(listProperty, "listProperty"); - ErrorUtilities.VerifyThrowArgumentLength(propertyId, "propertyId"); - - if (listProperty.Count == 0) - { - ErrorUtilities.ThrowArgument(Strings.ListPropertyShouldHaveAtLeastOneElement, propertyId); - } - } - - #region Extension Methods - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this Argument type) - { - string propertyId = GetPropertyId("Property", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Property, propertyId); - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this BaseProperty type) - { - string namePropertyId = GetPropertyId("Name", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Name, namePropertyId); - - string categoryPropertyId = GetPropertyId("Category", type.Name, type); - VerifyThrowPropertyEmptyString(typeCategory, categoryPropertyId); - - // Validate children. - if (null != type.DataSource) - { - type.DataSource.Validate(); - } - - foreach (Argument argument in type.Arguments) - { - argument.Validate(); - } - - foreach (ValueEditor editor in type.ValueEditors) - { - editor.Validate(); - } - - // Validate any known derivations. - BoolProperty boolProp = type as BoolProperty; - if (null != boolProp) - { - return; - } - - DynamicEnumProperty dynamicEnumProp = type as DynamicEnumProperty; - if (dynamicEnumProp != null) - { - dynamicEnumProp.Validate(); - return; - } - - EnumProperty enumProp = type as EnumProperty; - if (enumProp != null) - { - enumProp.Validate(); - return; - } - - IntProperty intProp = type as IntProperty; - if (intProp != null) - { - intProp.Validate(); - return; - } - - StringListProperty stringListProp = type as StringListProperty; - if (stringListProp != null) - { - return; - } - - StringProperty stringProp = type as StringProperty; - if (stringProp != null) - { - return; - } - - // Unknown derivation, but that's ok. - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this Category type) - { - string namePropertyId = GetPropertyId("Name", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Name, namePropertyId); - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this DataSource type) - { - string persistencePropertyId = GetPropertyId("Persistence", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Persistence, persistencePropertyId); - } - - /// - /// Validate the content type data integrity afte deserializing from XAML file - /// - internal void Validate(this ContentType type) - { - // content type must at least declare name, and msbuild ItemType to be workable at minimum level - string namePropertyId = GetPropertyId("Name", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Name, namePropertyId); - - string itemTypePropertyId = GetPropertyId("ItemType", type); - VerifyThrowPropertyNotSetOrEmptyString(type.ItemType, itemTypePropertyId); - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this DynamicEnumProperty type) - { - (type as BaseProperty).Validate(); - ErrorUtilities.VerifyThrowArgumentLength(type.EnumProvider, "EnumProvider"); - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - private void Validate(this EnumProperty type) - { - (type as BaseProperty).Validate(); - - // Validate that the "Default" field is not set on this property. - string defaultPropertyId = GetPropertyId("Default", type.Name, type); - if (null != Default) - { - ErrorUtilities.ThrowArgument(Strings.CannotSetDefaultPropertyOnEnumProperty, typeof(EnumProperty).Name, typeof(EnumValue).Name); - } - - // Make sure that at least one value was defined in AdmissibleValues. - string admissibleValuesId = GetPropertyId("AdmissibleValues", type.Name, type); - VerifyThrowListPropertyEmpty(type.AdmissibleValues, admissibleValuesId); - - // Validate that only one of the EnumValues under AdmissibleValues is marked IsDefault. - string admissibleValuesPropertyId = GetPropertyId("AdmissibleValues", type.Name, type); - - bool seen = false; - foreach (EnumValue enumValue in type.AdmissibleValues) - { - if (enumValue.IsDefault) - { - if (!seen) - { - seen = true; - } - else - { - ErrorUtilities.ThrowArgument(Strings.OnlyOneEnumValueCanBeSetAsDefault, typeof(EnumValue).Name, admissibleValuesPropertyId); - } - } - } - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this IntProperty type) - { - (type as BaseProperty).Validate(); - - if (null != type.MaxValue && null != type.MinValue) - { - if (type.MinValue > type.MaxValue) - { - string minValuePropertyId = GetPropertyId("MinValue", type.Name, type); - ErrorUtilities.ThrowArgument(Strings.MinValueShouldNotBeGreaterThanMaxValue, minValuePropertyId); - } - } - } - - /// - /// Validate the content type data integrity afte deserializing from XAML file - /// - internal void Validate(this ItemType type) - { - // content type must at least declare name, and msbuild ItemType to be workable at minimum level - string namePropertyId = GetPropertyId("Name", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Name, namePropertyId); - - if (type.DisplayName == null) - { - type.DisplayName = type.Name; - } - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this Rule type) - { - // Validate "Name" property. - string namePropertyId = GetPropertyId("Name", type); - VerifyThrowPropertyNotSetOrEmptyString(type.Name, namePropertyId); - - // Make sure that at least one Property was defined in this Rule. - string propertiesId = XamlErrorUtilities.GetPropertyId("Properties", Name, this); - VerifyThrowListPropertyEmpty(type.Properties, propertiesId); - - // Validate the child objects - foreach (BaseProperty property in type.Properties) - { - property.Validate(); - } - - foreach (Category category in type.Categories) - { - category.Validate(); - } - - // If the DataSource property is not defined on this Rule, check that a DataSource is - // specified locally on every property. - if (null == type.DataSource) - { - foreach (BaseProperty property in type.Properties) - { - string dataSourcePropertyId = GetPropertyId("DataSource", property.Name, property); - VerifyThrowPropertyNotSet(property.DataSource, dataSourcePropertyId, Strings.DataSourceMustBeDefinedOnPropertyOrOnRule); - } - } - else - { - type.DataSource.Validate(); - } - - // Create a HashSet for O(1) lookup. - HashSet propertyNames = new HashSet(); - foreach (BaseProperty property in type.Properties) - { - if (!propertyNames.Contains(property.Name)) - { - propertyNames.Add(property.Name); - } - } - - // Validate that every argument refers to a valid property. - foreach (BaseProperty property in type.Properties) - { - if (property.Arguments == null || property.Arguments.Count == 0) - { - continue; - } - - foreach (Argument argument in property.Arguments) - { - if (!propertyNames.Contains(argument.Property)) - { - ErrorUtilities.ThrowArgument(Strings.PropertyReferredToByArgumentDoesNotExist, argument.Property); - } - } - } - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this RuleBag type) - { - // Make sure that at least one Rule was defined in this RuleBag. - string rulesId = GetPropertyId("Rules", type); - VerifyThrowListPropertyEmpty(type.Rules, rulesId); - - foreach (Rule rule in Rules) - { - rule.Validate(); - } - } - - /// - /// Validates the properties of this object. This method should be called - /// after initialization is complete. - /// - internal void Validate(this ValueEditor type) - { - string propertyId = GetPropertyId("EditorType", type); - VerifyThrowPropertyNotSetOrEmptyString(type.EditorType, propertyId); - } - - #endregion - - } -} diff --git a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj index b5d9c668d35..801e8c76483 100644 --- a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj +++ b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj @@ -50,7 +50,6 @@ NativeMethodsShared_Tests.cs - diff --git a/src/Tasks/Microsoft.Build.Tasks.csproj b/src/Tasks/Microsoft.Build.Tasks.csproj index 9699f49dec9..cb55a7fe617 100644 --- a/src/Tasks/Microsoft.Build.Tasks.csproj +++ b/src/Tasks/Microsoft.Build.Tasks.csproj @@ -30,9 +30,6 @@ - - - @@ -66,15 +63,6 @@ AssemblyDependency\AssemblyFoldersFromConfig\Serialization\AssemblyFolderItem.cs - - BuildEnvironmentHelper.cs - - - AssemblyNameComparer.cs - - - AssemblyDependency\AssemblyNameReverseVersionComparer.cs - CanonicalError.cs @@ -83,56 +71,29 @@ - ExtensionFoldersRegistryKey.cs - - FileDelegates.cs - PropertyParser.cs - - ReadOnlyEmptyCollection.cs - RegistryDelegates.cs RegistryHelper.cs - - StrongNameHelpers.cs - - - SolutionConfiguration.cs - TaskLoggingHelperExtension.cs - - MetadataConversionUtilities.cs - StreamMappedString.cs - - StringUtils.cs - - - - - - VersionUtilities.cs - VisualStudioConstants.cs - - @@ -147,7 +108,6 @@ PlatformNegotiation.cs - @@ -296,6 +256,7 @@ + diff --git a/src/Tasks/ResolveComReference.cs b/src/Tasks/ResolveComReference.cs index c339ea9c5be..814754f5980 100644 --- a/src/Tasks/ResolveComReference.cs +++ b/src/Tasks/ResolveComReference.cs @@ -18,6 +18,7 @@ // TYPELIBATTR clashes with the one in InteropServices. using TYPELIBATTR = System.Runtime.InteropServices.ComTypes.TYPELIBATTR; using UtilitiesProcessorArchitecture = Microsoft.Build.Utilities.ProcessorArchitecture; +using UtilitiesDotNetFrameworkArchitecture = Microsoft.Build.Utilities.DotNetFrameworkArchitecture; #endif using Microsoft.Build.Framework; @@ -570,12 +571,12 @@ private string GetPathToSDKFileWithCurrentlyTargetedArchitecture(string file, Ta { case UtilitiesProcessorArchitecture.ARM: case UtilitiesProcessorArchitecture.X86: - path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, DotNetFrameworkArchitecture.Bitness32); + path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, UtilitiesDotNetFrameworkArchitecture.Bitness32); break; case UtilitiesProcessorArchitecture.AMD64: case UtilitiesProcessorArchitecture.IA64: case UtilitiesProcessorArchitecture.ARM64: - path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, DotNetFrameworkArchitecture.Bitness64); + path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, UtilitiesDotNetFrameworkArchitecture.Bitness64); break; case UtilitiesProcessorArchitecture.MSIL: default: diff --git a/src/Shared/StrongNameHelpers.cs b/src/Tasks/Utilities/StrongNameHelpers.cs similarity index 100% rename from src/Shared/StrongNameHelpers.cs rename to src/Tasks/Utilities/StrongNameHelpers.cs diff --git a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj index 9f5dc1cf08d..fc358d0663e 100644 --- a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj +++ b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj @@ -28,7 +28,6 @@ - NativeMethods.cs diff --git a/src/Utilities/Microsoft.Build.Utilities.csproj b/src/Utilities/Microsoft.Build.Utilities.csproj index 91325b42c49..655dd9bc872 100644 --- a/src/Utilities/Microsoft.Build.Utilities.csproj +++ b/src/Utilities/Microsoft.Build.Utilities.csproj @@ -51,48 +51,18 @@ Shared\AssemblyFolders\Serialization\AssemblyFolderItem.cs - - Shared\BuildEnvironmentHelper.cs - Shared\CanonicalError.cs Shared\ExtensionFoldersRegistryKey.cs - - Shared\FileDelegates.cs - - - Shared\CopyOnWriteDictionary.cs - Shared\ErrorUtilities.cs - - Shared\EventArgsFormatting.cs - - - Shared\FileMatcher.cs - - - Shared\FrameworkLocationHelper.cs - - - Shared\IKeyed.cs - Shared\InprocTrackingNativeMethods.cs - - Shared\ProcessExtensions.cs - - - Shared\ReadOnlyEmptyCollection.cs - - - Shared\Collections\ReadOnlyEmptyDictionary.cs - Shared\RegistryDelegates.cs @@ -108,12 +78,6 @@ Shared\Tracing.cs - - Shared\VersionUtilities.cs - - - Shared\ToolsetElement.cs -