private void GiveErrorForMissingRuntimeIdentifier()
        {
            string runtimePiece = '"' + RuntimeIdentifier + "\": { }";

            bool hasRuntimesSection;
            try
            {
                using (var streamReader = new StreamReader(new FileStream(ProjectLockFile.Replace(".lock.json", ".json"), FileMode.Open, FileAccess.Read, FileShare.Read)))
                {
                    var jsonFile = JObject.Load(new JsonTextReader(streamReader));
                    hasRuntimesSection = jsonFile["runtimes"] != null;
                }
            }
            catch
            {
                // User has a bad file, locked file, no file at all, etc. We'll just assume they have one.
                hasRuntimesSection = true;
            }

            if (hasRuntimesSection)
            {
                ThrowExceptionIfNotAllowingFallback(nameof(Strings.MissingRuntimeInRuntimesSection), RuntimeIdentifier, runtimePiece);
            }
            else
            {
                var runtimesSection = "\"runtimes\": { " + runtimePiece + " }";
                ThrowExceptionIfNotAllowingFallback(nameof(Strings.MissingRuntimesSection), runtimesSection);
            }
        }
        private void GiveErrorForMissingRuntimeIdentifier()
        {
            var runtimePiece    = RuntimeIdentifier;
            var runtimesSection = $"<{RuntimeIdentifiersProperty}>{RuntimeIdentifier}</{RuntimeIdentifiersProperty}>";
            var missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierInProjectFile);
            var missingRuntimesErrorString          = nameof(Strings.MissingRuntimeIdentifierPropertyInProjectFile);

            if (IsLockFileProjectJsonBased(ProjectLockFile))
            {
                runtimePiece    = '"' + RuntimeIdentifier + "\": { }";
                runtimesSection = "\"runtimes\": { " + runtimePiece + " }";
                missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeInProjectJson);
                missingRuntimesErrorString          = nameof(Strings.MissingRuntimesSectionInProjectJson);
            }

            bool hasRuntimesSection = true;

            try
            {
                // try reading the project.json file only of the project is project.json based
                if (IsLockFileProjectJsonBased(ProjectLockFile))
                {
                    using (var streamReader = new StreamReader(ProjectLockFile.Replace(".lock.json", ".json")))
                    {
                        var jsonFile = JObject.Load(new JsonTextReader(streamReader));
                        hasRuntimesSection = jsonFile["runtimes"] != null;
                    }
                }
            }
            catch
            {
                // User has a bad file, locked file, no file at all, etc. We'll just assume they have one.
                hasRuntimesSection = true;
            }

            if (hasRuntimesSection)
            {
                ThrowExceptionIfNotAllowingFallback(missingRuntimeInRuntimesErrorString, RuntimeIdentifier, runtimePiece);
            }
            else
            {
                ThrowExceptionIfNotAllowingFallback(missingRuntimesErrorString, runtimesSection);
            }
        }