public override bool AddToProject(SolutionItem parent, Project project, string language, string directory, string name)
        {
            // Replace template variables

            string cname = Path.GetFileNameWithoutExtension(name);

            string[,] tags =
            {
                { "Name", cname },
            };

            string content = addinTemplate.OuterXml;

            content = StringParserService.Parse(content, tags);

            // Create the manifest

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(content);

            string file = Path.Combine(directory, "manifest.addin.xml");

            doc.Save(file);

            project.AddFile(file, BuildAction.EmbeddedResource);

            AddinData.EnableAddinAuthoringSupport((DotNetProject)project);
            return(true);
        }
Beispiel #2
0
        public void ApplyFeature(SolutionFolder parentCombine, SolutionItem entry, Widget ed)
        {
            AddinFeatureWidget editor = (AddinFeatureWidget)ed;
            AddinData          data   = AddinData.EnableAddinAuthoringSupport((DotNetProject)entry);

            DotNetProject project = (DotNetProject)entry;

            if (editor.HasRegistryInfo)
            {
                project.GetAddinData().ApplicationName = editor.ApplicationName;
            }

            AddinDescription desc = data.LoadAddinManifest();

            if (editor.AddinId.Length > 0)
            {
                desc.LocalId = editor.AddinId;
            }
            if (editor.AddinName.Length > 0)
            {
                desc.Name = editor.AddinName;
            }
            desc.Namespace = editor.AddinNamespace;
            desc.IsRoot    = project.CompileTarget != CompileTarget.Library || editor.IsRoot;
            desc.Version   = "1.0";
            desc.Save();
            data.NotifyChanged();
        }