public void Execute(ProjectConfiguration configuration, string selectedProject) { DirectoryInfo projectDirectory = new DirectoryInfo(configuration.RootPath); List<FileSystemInfo> projectFiles = projectDirectory .EnumerateFileSystemInfos("*.csproj", SearchOption.AllDirectories) .ToList(); var targetProjects = configuration.ResolveAssemblies(selectedProject); if (_checkOnlyDependencies) { var projectSetup = new ProjectSetup { WhenAssemblyKeyFileNotFound = ProjectSetupBehavior.Valid, WhenContainsFileReferences = ProjectSetupBehavior.Valid, WhenContainsProjectReferences = ProjectSetupBehavior.Warn, WhenReferenceNotResolved = ProjectSetupBehavior.Warn, WhenReferenceResolvedInDifferentLocation = ProjectSetupBehavior.Warn, WhenRequiredProjectLinkNotFound = ProjectSetupBehavior.Valid }; var consoleLogger = ConsoleLogger.Default; var generator = new SolutionGenerator.Toolkit.SolutionGenerator(consoleLogger); var projectLoader = generator.GetProjectLoader(projectSetup, configuration.RootPath); var targetProjectFiles = generator.GetTargetProjectFiles(projectLoader, targetProjects); ReferenceWalker walker = new ReferenceWalker(consoleLogger); var dependencies = walker.WalkReferencesRecursively( projectSetup, projectLoader, targetProjectFiles, new[] {configuration.ThirdPartiesRootPath}, new HashSet<string>()); projectFiles = new List<FileSystemInfo>(); foreach (var dependency in dependencies) { var project = projectLoader.GetProjectById(dependency); projectFiles.Add(new FileInfo(project.ProjectFileLocation)); } } ChangeOutputPath(projectFiles, configuration.RootPath, configuration.BinariesOutputPath, targetProjects); ChangeReferences(projectFiles, configuration.RootPath, configuration.BinariesOutputPath, configuration.TargetFrameworkVersion, configuration.GetSystemRuntimeReferenceMode, configuration.GetSpecificVersionReferenceMode, targetProjects); ChangeProjectSettings(projectFiles); }
private int GenerateSolution(string projectPath, string thirdParties, string[] targetProjects) { var projectSetup = new ProjectSetup { WhenAssemblyKeyFileNotFound = ProjectSetupBehavior.Valid, WhenContainsFileReferences = ProjectSetupBehavior.Valid, WhenContainsProjectReferences = ProjectSetupBehavior.Warn, WhenReferenceNotResolved = ProjectSetupBehavior.Warn, WhenReferenceResolvedInDifferentLocation = ProjectSetupBehavior.Warn, WhenRequiredProjectLinkNotFound = ProjectSetupBehavior.Valid }; SolutionGenerator.Toolkit.SolutionGenerator generator = new SolutionGenerator.Toolkit.SolutionGenerator(ConsoleLogger.Default); return generator.CreateSolution(projectSetup, _solutionOutputPath, projectPath, thirdParties, targetProjects); }
private int CopyThirdParties(string projectPath, string thirdParties, string targetProject) { var projectSetup = new ProjectSetup { WhenAssemblyKeyFileNotFound = ProjectSetupBehavior.Valid, WhenContainsFileReferences = ProjectSetupBehavior.Valid, WhenContainsProjectReferences = ProjectSetupBehavior.Warn, WhenReferenceNotResolved = ProjectSetupBehavior.Warn, WhenReferenceResolvedInDifferentLocation = ProjectSetupBehavior.Warn, WhenRequiredProjectLinkNotFound = ProjectSetupBehavior.Valid }; SolutionGenerator.Toolkit.SolutionGenerator generator = new SolutionGenerator.Toolkit.SolutionGenerator(new ConsoleLogger()); return generator.CopyThirdParties(projectSetup, _outputPath, projectPath, thirdParties, new[] {targetProject}); }