internal static string[] GetProjectItemFooter(this VsSolutionFileProject projectItem)
 {
     return(new string[]
     {
         "EndProject"
     });
 }
 internal static string[] GetProjectItemHeader(this VsSolutionFileProject projectItem)
 {
     return(new string[]
     {
         "Project(\"{" + projectItem.ProjectTypeId.ToString().ToUpper() + "}\") = \"" + projectItem.ProjectName + "\", \"" + projectItem.ProjectPath + "\", \"{" + projectItem.ProjectId.ToString().ToUpper() + "}\""
     });
 }
        public static VsSolutionFileProject AddProject(this VsSolutionFileProject proj, string filepath)
        {
            var addedProj = proj.Solution.AddProjectFile(filepath);

            addedProj.ParentPoject = proj.ProjectId;

            return(addedProj);
        }
Beispiel #4
0
 private void AddProjectConfigurationForProject(VsSolutionFileProject project)
 {
     if (project.ProjectTypeId == VsSolutionProjectTypeIds.VsSolutionProjectTypeCSharp)
     {
         foreach (var item in this.GlobalSections["SolutionConfigurationPlatforms"].Items)
         {
             this.GlobalSections["ProjectConfigurationPlatforms"].Items.Add(
                 "{" + project.ProjectId.ToString().ToUpper() + "." + item.Key + ".ActiveCfg", item.Value);
             this.GlobalSections["ProjectConfigurationPlatforms"].Items.Add(
                 "{" + project.ProjectId.ToString().ToUpper() + "." + item.Key + ".Build.0", item.Value);
         }
     }
 }
        internal static string[] GetProjectItemLines(this VsSolutionFileProject projectItem)
        {
            var text = new List <string>();

            text.AddRange(projectItem.GetProjectItemHeader());
            if (projectItem.ProjectTypeId == VsSolutionProjectTypeIds.VsSolutionProjectTypeSolutionFolder)
            {
                text.AddRange(GetProjectItemContentFolderSolutionFiles(projectItem.Files));
            }
            text.AddRange(projectItem.GetProjectItemFooter());

            return(text.ToArray());
        }
        public static string AddFile(this VsSolutionFileProject proj, string filepath)
        {
            if (proj.ProjectTypeId != VsSolutionProjectTypeIds.VsSolutionProjectTypeSolutionFolder)
            {
                throw new NotImplementedException("Diese methode ist nur für SolutionFodler vorgesehen.");
            }

            var filename         = Path.GetFileName(filepath);
            var relativeFilepath = filepath;

            if (filepath.ToLower().StartsWith(proj.Solution.SolutionFolder))
            {
                relativeFilepath = filepath.Substring(proj.Solution.SolutionFolder.Length);
            }
            relativeFilepath = proj.Solution.GetRelativePathToSolutionFolder(filepath);
            proj.Files.Add(filename, relativeFilepath);

            return(relativeFilepath);
        }