Exemple #1
0
        public static ProjectJsonFile Read(DnxProject project)
        {
            var jsonFile = new ProjectJsonFile(project.BaseDirectory.Combine("project.json"));

            jsonFile.Read();
            return(jsonFile);
        }
Exemple #2
0
        public void RemoveNuGetPackage(string frameworkShortName, string packageId)
        {
            var jsonFile = ProjectJsonFile.Read(this);

            if (jsonFile.Exists)
            {
                jsonFile.RemoveNuGetPackage(frameworkShortName, packageId);
                jsonFile.Save();
                FileService.NotifyFileChanged(jsonFile.Path);
            }
            else
            {
                LoggingService.LogDebug("Unable to find project.json '{0}'", jsonFile.Path);
            }
        }
Exemple #3
0
        public void AddNuGetPackages(IEnumerable <NuGetPackageToAdd> packagesToAdd)
        {
            var jsonFile = ProjectJsonFile.Read(this);

            if (jsonFile.Exists)
            {
                jsonFile.AddNuGetPackages(packagesToAdd);
                jsonFile.Save();
                FileService.NotifyFileChanged(jsonFile.Path);
            }
            else
            {
                LoggingService.LogDebug("Unable to find project.json '{0}'", jsonFile.Path);
            }
        }
        public bool HasTestRunner()
        {
            if (hasTestRunner.HasValue)
            {
                return(hasTestRunner.Value);
            }

            try {
                var jsonFile = ProjectJsonFile.Read(this);
                if (jsonFile.Exists)
                {
                    hasTestRunner = jsonFile.HasTestRunner();
                    return(hasTestRunner.Value);
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogError("Unable to read project.json file", ex);
            }

            return(false);
        }
Exemple #5
0
        protected override void OnReferenceRemovedFromProject(ProjectReferenceEventArgs e)
        {
            base.OnReferenceRemovedFromProject(e);

            if (addingReferences)
            {
                return;
            }

            if (e.ProjectReference.ReferenceType == ReferenceType.Project)
            {
                var jsonFile = ProjectJsonFile.Read(this);
                if (jsonFile.Exists)
                {
                    jsonFile.RemoveProjectReference(e.ProjectReference);
                    jsonFile.Save();
                    FileService.NotifyFileChanged(jsonFile.Path);
                }
                else
                {
                    LoggingService.LogDebug("Unable to find project.json '{0}'", jsonFile.Path);
                }
            }
        }
 public static ProjectJsonFile Read(DnxProject project)
 {
     var jsonFile = new ProjectJsonFile (project.BaseDirectory.Combine ("project.json"));
     jsonFile.Read ();
     return jsonFile;
 }