Bari.Plugins.VCpp.VisualStudio.VcxprojSections.StaticLibraryReferencesSection.Write C# (CSharp) Method

Write() public method

Writes the section using an XML writer
public Write ( XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context ) : void
writer System.Xml.XmlWriter XML writer to use
project Project The project to generate .csproj for
context IMSBuildProjectGeneratorContext Current .csproj generation context
return void
        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            writer.WriteStartElement("ItemGroup");

            foreach (var refPath in context.References)
            {
                if (((string) refPath).StartsWith("SLN!"))
                {
                    var moduleAndprojectName = ((string) refPath).Substring(4);
                    var parts = moduleAndprojectName.Split('#');
                    var moduleName = parts[0];
                    var projectName = parts[1];

                    var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName);

                    if (referredProject.Type == ProjectType.StaticLibrary)
                    {
                        writer.WriteStartElement("ProjectReference");
                        writer.WriteAttributeString("Include",
                            ToProjectRelativePath(project, Path.Combine(Suite.SuiteRoot.GetRelativePath(referredProject.RootDirectory), "cpp", projectName+".vcxproj"), "cpp"));
                        writer.WriteElementString("Project", projectGuidManagement.GetGuid(project).ToString("B"));
                        writer.WriteEndElement();
                    }
                }
            }

            writer.WriteEndElement();
        }
StaticLibraryReferencesSection