Ejemplo n.º 1
0
        public static ProjectReferenceXElement New(XElement parent, string projectFilePath)
        {
            var projectReference = ProjectReferenceXElement.New(projectFilePath);

            parent.Add(projectReference.Value);

            return(projectReference);
        }
        public static bool HasProjectReference(this ProjectReferencesItemGroupXElement projectReferencesItemGroupXElement, string projectFilePath, out IProjectReference projectReference)
        {
            projectReference = projectReferencesItemGroupXElement.GetProjectReferenceXElementsWhereProjectFilePath(projectFilePath)
                               .Select(xElement => ProjectReferenceXElement.From(xElement))
                               .SingleOrDefault();

            var hasProjectReference = ProjectReferenceHelper.WasFound(projectReference);

            return(hasProjectReference);
        }
Ejemplo n.º 3
0
        public static ProjectReferenceXElement New(string projectFilePath)
        {
            var xProjectReference = new XElement(ProjectFileXmlElementName.ProjectReference);

            xProjectReference.AddAttribute(ProjectFileXmlElementName.Include, projectFilePath);

            var projectReferenceXElement = ProjectReferenceXElement.From(xProjectReference);

            return(projectReferenceXElement);
        }
        public static IProjectReference AddProjectReference(this ProjectReferencesItemGroupXElement projectReferencesItemGroupXElement, string projectFilePath)
        {
            var hasProjectReferenceAlready = projectReferencesItemGroupXElement.HasProjectReference(projectFilePath);

            if (hasProjectReferenceAlready)
            {
                throw new InvalidOperationException($"Project already has project reference:\n{projectFilePath}");
            }

            var projectReference = ProjectReferenceXElement.New(projectReferencesItemGroupXElement, projectFilePath);

            return(projectReference);
        }
Ejemplo n.º 5
0
        public static ProjectReferenceXElement New(ProjectReferencesItemGroupXElement parent, string projectFilePath)
        {
            var projectReference = ProjectReferenceXElement.New(parent.Value, projectFilePath);

            return(projectReference);
        }
Ejemplo n.º 6
0
        public static ProjectReferenceXElement From(XElement value)
        {
            var projectReferenceXElement = new ProjectReferenceXElement(value);

            return(projectReferenceXElement);
        }