/// <summary>
        /// Ensures Physical Folder existence
        /// </summary>
        public override void Execute()
        {
            EnvDTE.DTE vs = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE));
            path = "";

            // TODO: this code should be in DteHelper
            // In some case vs.Solution.FullName == ""
            if (vs.Solution.FullName != "")
            {
                path = DteHelper.GetPathFull(vs, DteHelper.BuildPath(solutionFolder));
            }
            else
            {
                Property property = vs.Solution.Properties.Item("Path");
                path = System.IO.Path.GetDirectoryName(property.Value.ToString());

                path = System.IO.Path.Combine(path, DteHelper.BuildPath(solutionFolder));
            }

            if (!string.IsNullOrEmpty(path))
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
            }
            else
            {
                // throw an exception.
            }
        }
Example #2
0
        private void DeleteItem(ProjectItem projectItem, DTE vs)
        {
            string itemPath = DteHelper.BuildPath(projectItem);

            itemPath = DteHelper.GetPathFull(vs, itemPath);

            projectItem.Remove();
            projectItem.Delete();
        }
        /// <summary>
        /// Delete ProjectItems content filtering by the input kind guid
        /// </summary>
        public override void Execute()
        {
            foreach (ProjectItem projectItem in projectItems)
            {
                if ((string.IsNullOrEmpty(kind) || (projectItem.Kind == kind)))
                {
                    DTE    vs       = (DTE)GetService(typeof(DTE));
                    string itemPath = DteHelper.BuildPath(projectItem);
                    itemPath = DteHelper.GetPathFull(vs, itemPath);

                    projectItem.Delete();

                    File.Delete(itemPath);
                }
            }
        }