/// <summary> /// Determine whether we would ever load read only /// </summary> private void DetermineWhetherToLoadReadOnlyIfPossible() { if (s_readOnlyFlags == ReadOnlyLoadFlags.Undefined) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllWriteable; if (String.Equals(Environment.GetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly"), "true", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadReadOnlyIfAppropriate; } if (String.Equals(Environment.GetEnvironmentVariable("MSBUILDLOADALLFILESASREADONLY"), "1", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllReadOnly; } // "Escape hatch" should someone really need to edit these - since we'll be switching it on in VS and msbuild.exe wholesale. if (String.Equals(Environment.GetEnvironmentVariable("MSBUILDLOADALLFILESASWRITEABLE"), "1", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllWriteable; } } }
/// <summary> /// Determine whether we would ever load read only /// </summary> private void DetermineWhetherToLoadReadOnlyIfPossible() { if (s_readOnlyFlags == ReadOnlyLoadFlags.Undefined) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllWriteable; if (String.Equals(Environment.GetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly"), "true", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadReadOnlyIfAppropriate; } if (String.Equals(Environment.GetEnvironmentVariable("MSBUILDLOADALLFILESASREADONLY"), "1", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllReadOnly; } // "Escape hatch" should someone really need to edit these - since we'll be switching it on in VS and msbuild.exe wholesale. if (String.Equals(Environment.GetEnvironmentVariable("MSBUILDLOADALLFILESASWRITEABLE"), "1", StringComparison.OrdinalIgnoreCase)) { s_readOnlyFlags = ReadOnlyLoadFlags.LoadAllWriteable; } } }
/// <summary> /// Reset state for unit tests that want to set the env var /// </summary> internal static void ClearReadOnlyFlags_UnitTestsOnly() { s_readOnlyFlags = ReadOnlyLoadFlags.Undefined; }
/// <summary> /// Reset state for unit tests that want to set the env var /// </summary> internal static void ClearReadOnlyFlags_UnitTestsOnly() { s_readOnlyFlags = ReadOnlyLoadFlags.Undefined; }