当前位置: 首页>>代码示例>>C#>>正文


C# SolutionFolder.AddFromTemplate方法代码示例

本文整理汇总了C#中SolutionFolder.AddFromTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# SolutionFolder.AddFromTemplate方法的具体用法?C# SolutionFolder.AddFromTemplate怎么用?C# SolutionFolder.AddFromTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SolutionFolder的用法示例。


在下文中一共展示了SolutionFolder.AddFromTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewTemplateItemInSolutionFolder

 private static void NewTemplateItemInSolutionFolder(string path, string itemTypeName, Solution2 sln,
                                                     NewItemDynamicParameters p, SolutionFolder folder)
 {
     var destinationPath = Path.Combine(
         Path.GetDirectoryName(sln.FullName),
         path
         );
     try
     {
         var n = sln.GetProjectTemplate(itemTypeName, p.Category);
         folder.AddFromTemplate(n, destinationPath, path);
     }
     catch (FileNotFoundException)
     {
         var n = sln.GetProjectItemTemplate(itemTypeName, p.Category);
         folder.AddFromTemplate(n, destinationPath, path);
     }
 }
开发者ID:wangchunlei,项目名称:MyGit,代码行数:18,代码来源:NewProjectItemManager.cs

示例2: BuildThemeWithProject

        /// <summary>
        /// Builds a blank theme including a project file.
        /// </summary>
        /// <param name="themesFolder">The themes folder.</param>
        /// <param name="vm">The vm.</param>
        /// <param name="templates">The templates.</param>
        /// <param name="themeType">Type of theme.</param>
        private void BuildThemeWithProject(SolutionFolder themesFolder, ThemeViewModel vm, string templates, string themeType)
        {
            var solution = GetGlobalService(typeof(SVsSolution)) as IVsSolution;
            var envsol = dte.Solution;

            string solpath;
            string solfile;
            string soloptions;
            solution.GetSolutionInfo(out solpath, out solfile, out soloptions);

            var newDir = Path.Combine(solpath, "Orchard.Web", "Themes", vm.ThemeName);
            var newproj = themesFolder.AddFromTemplate(Path.Combine(templates, themeType, vm.Version, themeType + ".csproj"), newDir, vm.ThemeName);

            Insert(Path.Combine(newDir, vm.ThemeName + ".csproj"),
                new List<KeyValuePair<string, string>>
                {
                    new KeyValuePair<string, string>("$$ModuleProjectGuid$$", Guid.NewGuid().ToString()),
                    new KeyValuePair<string, string>("$$ModuleName$$", vm.ThemeName)
                });
            // this does work...
            newproj.Properties.Item("AssemblyName").Value = vm.ThemeName;
            // need this as well because... I have no idea
            newproj.Properties.Item("RootNamespace").Value = vm.ThemeName;
            EditThemeFile(newDir, vm);

            // isn't added to tfs for some reason...
            if (vm.IncludeHelpFile)
                newproj.ProjectItems.AddFromFile(templates + "\\ThemeHelp.md");

            newproj.Save();
        }
开发者ID:OsvaldoJ,项目名称:orchardizer,代码行数:38,代码来源:OrchardizerPackage.cs


注:本文中的SolutionFolder.AddFromTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。