Exemplo n.º 1
0
        public static IEnumerable <ProjectItem> GetOutputFilesAsProjectItems(EnvDTE.DTE dte, IEnumerable <OutputFile> outputFiles)
        {
            var fileNames = (from o in outputFiles
                             select Path.GetFileName(o.FileName)).ToArray();

            return(VSHelper.GetAllSolutionItems(dte).Where(f => fileNames.Contains(f.Name)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Removes old template placeholders from the solution.
        /// </summary>
        private void CleanUpTemplatePlaceholders()
        {
            string[] activeTemplateFullNames    = this.templatePlaceholderList.ToArray();
            string[] allHelperTemplateFullNames = VSHelper.GetAllSolutionItems(this.dte)
                                                  .Where(p => p.Name == VSHelper.GetTemplatePlaceholderName(this.templateProjectItem))
                                                  .Select(p => VSHelper.GetProjectItemFullPath(p))
                                                  .ToArray();

            var delta = allHelperTemplateFullNames.Except(activeTemplateFullNames).ToArray();

            var dirtyHelperTemplates = VSHelper.GetAllSolutionItems(this.dte)
                                       .Where(p => delta.Contains(VSHelper.GetProjectItemFullPath(p)));

            foreach (ProjectItem item in dirtyHelperTemplates)
            {
                if (item.ProjectItems != null)
                {
                    foreach (ProjectItem subItem in item.ProjectItems)
                    {
                        subItem.Remove();
                    }
                }

                item.Remove();
            }
        }