//private static void TargetPackageSource (ConcreteBuildRunner runner) //{ // List<string> files = new List<string>(); // string solutionDirectoryPath = Path.GetFullPath ( // Path.Combine ( // Environment.CurrentDirectory, // runner.Solution.SolutionDirectoryPath)); // files.Add(Path.GetFullPath(runner.Solution.SolutionFileName)); // Regex excludeFilter = new Regex(@"\.snk$"); // runner // .Solution // .ForEachProject(p => AddProjectFiles(p, solutionDirectoryPath, files, excludeFilter)); // ZipFilesTask zipFilesTask = new ZipFilesTask( // Path.Combine(runner.BuildPackagesDir, runner.ProductName + "-sources.zip"), // solutionDirectoryPath, // files); // zipFilesTask.CompressionLevel = 9; // zipFilesTask.ZipFileHeaderCallback = GetLicenseHeaderForSourceFiles; // runner.RunTask(zipFilesTask); //} private static void AddProjectFiles( VSProjectInfo project, string solutionDirectoryPath, ICollection <string> files, Regex excludeFilter) { if (project is VSProjectWithFileInfo) { VSProjectWithFileInfo projectWithFileInfo = (VSProjectWithFileInfo)project; files.Add(projectWithFileInfo.ProjectFileNameFull.ToFullPath().ToString()); foreach (VSProjectItem item in projectWithFileInfo.Project.Items) { if (item.ItemType == VSProjectItem.CompileItem || item.ItemType == VSProjectItem.Content || item.ItemType == VSProjectItem.NoneItem) { if (item.ItemProperties.ContainsKey("Link")) { continue; } string itemPath = Path.GetFullPath( Path.Combine( solutionDirectoryPath, Path.Combine( projectWithFileInfo.ProjectDirectoryPath.ToString(), item.Item))); if (excludeFilter.IsMatch(itemPath)) { continue; } files.Add(itemPath); } } } else if (project is VSSolutionFilesInfo) { VSSolutionFilesInfo solutionFilesInfo = (VSSolutionFilesInfo)project; foreach (string file in solutionFilesInfo.Files) { string fullPath = Path.GetFullPath(Path.Combine(solutionDirectoryPath, file)); if (excludeFilter.IsMatch(fullPath)) { continue; } files.Add(fullPath); } } }
public void CheckSolutionFiles() { VSSolution solution = VSSolution.Load(@"..\..\..\ProjectPilot.sln"); VSProjectInfo project = solution.FindProjectByName("Samples"); Assert.IsInstanceOfType(typeof(VSSolutionFilesInfo), project); VSSolutionFilesInfo solutionFilesInfo = (VSSolutionFilesInfo)project; Assert.AreEqual(18, solutionFilesInfo.Files.Count); }
public VSProjectExtendedInfo(VSProjectInfo projectInfo) { this.projectInfo = projectInfo; }