Exemplo n.º 1
0
        /// <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;
                }
            }
        }
Exemplo n.º 2
0
        /// <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;
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Reset state for unit tests that want to set the env var
 /// </summary>
 internal static void ClearReadOnlyFlags_UnitTestsOnly()
 {
     s_readOnlyFlags = ReadOnlyLoadFlags.Undefined;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Reset state for unit tests that want to set the env var
 /// </summary>
 internal static void ClearReadOnlyFlags_UnitTestsOnly()
 {
     s_readOnlyFlags = ReadOnlyLoadFlags.Undefined;
 }