Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
        public static ProjectReferenceXElement New(ProjectReferencesItemGroupXElement parent, string projectFilePath)
        {
            var projectReference = ProjectReferenceXElement.New(parent.Value, projectFilePath);

            return(projectReference);
        }
Beispiel #6
0
        public static ProjectReferenceXElement From(XElement value)
        {
            var projectReferenceXElement = new ProjectReferenceXElement(value);

            return(projectReferenceXElement);
        }