예제 #1
0
        private void EnsureCpsProjFile(string cpsProjFileName)
        {
            var fileInfo = new FileInfo(cpsProjFileName);

            if (fileInfo.Exists)
            {
                return;
            }

            var xProj = new XProject();

            xProj.Add(
                new XPropertyGroup("Globals", null,
                                   new XProperty("ProjectGuid", Guid.NewGuid().ToString("D")),
                                   new XProperty("ManifestPath", "Cargo.toml")
                                   ),
                new XProjElement("Import", new XAttribute("Project", @"$(MSBuildExtensionsPath)\VisualRust\VisualRust.Rust.targets")),
                new XProjElement("Import",
                                 new XAttribute("Project", @"$(MSBuildThisFileName).InMemory.Targets"),
                                 new XAttribute("Condition", "Exists('$(MSBuildThisFileName).InMemory.Targets')")
                                 )
                );

            var xProjDocument = new XProjDocument(xProj);

            using (var writer = fileInfo.CreateText())
            {
                xProjDocument.Save(writer);
            }
        }
예제 #2
0
        protected void AddView(View view, XProject xProject)
        {
            Progress?.Report($"Adding view: {view.Name}");
            XView xView = XView.Create(view);

            xProject.Add(xView);
            foreach (Page page in view.Pages)
            {
                AddPage(page, xView);
            }
        }
예제 #3
0
        protected override XTemplate CreateCore()
        {
            XTemplate xTemplate = new XTemplate(TemplateLevel.Page)
            {
                Name = Page.Name
            };
            XProject xProject = new XProject();

            xTemplate.Add(xProject);
            XView xView = new XView
            {
                CheckCode = Page.GetView().CheckCode
            };

            xProject.Add(xView);
            AddPage(Page, xView);
            return(xTemplate);
        }