Dalibor Votruba 9d4313aa6c FilteredSolutionsExtension: add comments, refresh readme.md 1 жил өмнө
..
bo_strong_key_pair.snk 2371847b6d FilteredSolutionsExtension: correct solution directory structure 1 жил өмнө
fse_icon.ico 2371847b6d FilteredSolutionsExtension: correct solution directory structure 1 жил өмнө
getting_started.txt cdcf219170 FilteredSolutionsExtension: add tools to manage sources in AI. add getting_started.txt 1 жил өмнө
licence.txt 2371847b6d FilteredSolutionsExtension: correct solution directory structure 1 жил өмнө
readme.md 9d4313aa6c FilteredSolutionsExtension: add comments, refresh readme.md 1 жил өмнө
releasenote.txt 2371847b6d FilteredSolutionsExtension: correct solution directory structure 1 жил өмнө
screenshot.png 2371847b6d FilteredSolutionsExtension: correct solution directory structure 1 жил өмнө

readme.md

Visual Studio 2022 Filtered Solutions Extension v1.0

A Visual Studio 2022 extension that automatically presents a project filter dialog when opening solutions with multiple projects, allowing you to create filtered solutions with only the projects you need. This significantly improves performance and reduces clutter when working with large solutions.

🚀 Key Features

  • 🔄 Automatic Dialog: Shows project filter dialog when opening solutions with multiple projects
  • 🌳 Interactive Project Tree: Hierarchical tree view with checkboxes showing project dependencies
  • 🧠 Smart Dependencies: Automatically selects/deselects dependent projects when you check/uncheck projects
  • 🔍 Pattern Filtering: Filter projects using wildcard patterns (e.g., *.Test, Core*, *Data*)
  • ⚡ Bulk Operations: "Select All", "Clear All", and "Select Tests" buttons for quick selection
  • 📁 Safe Operation: Creates new filtered solution files, leaving originals untouched
  • 🎯 Manual Access: File menu command for manual filtering of already opened solutions
  • 💾 Custom Save: Save filtered solutions to custom locations with "Save As..." feature

📋 Requirements

  • Visual Studio: 2022 (17.0 or later)
  • Framework: .NET Framework 4.7.2
  • OS: Windows (tested on Windows 10/11)

🏗️ Architecture Overview

Core Components

📦 Package & Events

  • FilteredSolutionsExtensionPackage.cs: Main VS package entry point, initializes commands and events
  • SolutionEventsHandler.cs: Monitors solution opening/closing events with robust timing handling
  • SolutionOpeningInterceptor.cs: Alternative solution monitoring using running document table

🎨 User Interface

  • ProjectFilterDialog.xaml/.cs: Modern WPF dialog with tree view, filtering, and bulk operations
  • ManualFilterCommand.cs: File menu command for manual solution filtering

🔧 Core Logic

  • SolutionParser.cs: Parses .sln files and project dependencies with regex-based parsing
  • FilteredSolutionGenerator.cs: Creates new solution files with path remapping support
  • ProjectNode.cs: Represents projects with dependency relationships
  • ProjectTreeItem.cs: UI model for tree view with rich display properties

🛠️ Utilities

  • FileUtils.cs: Async file operations compatible with .NET 4.7.2
  • ErrorHandler.cs: Centralized error logging and user notifications
  • ExtensionSettings.cs: Settings persistence with JSON serialization
  • DebugHelper.cs: Development debugging and logging utilities

🎯 How It Works

Automatic Workflow

  1. Solution Detection: Extension monitors IVsSolutionEvents for solution opening
  2. Multi-Project Check: Only shows dialog for solutions with 2+ projects
  3. Background Loading: Waits for complete solution load using OnAfterBackgroundSolutionLoadComplete
  4. Dialog Presentation: Shows interactive filter dialog with project tree
  5. Dependency Analysis: Parses project references from both .sln and .csproj files
  6. Smart Selection: Auto-selects dependencies when projects are checked
  7. Solution Generation: Creates filtered .sln file with proper path remapping
  8. Seamless Transition: Closes original and opens filtered solution

Manual Workflow

  1. Menu Access: File → "Filter Solution Projects..."
  2. Same Dialog: Uses identical filtering interface
  3. Current Solution: Filters the currently opened solution
  4. Custom Save: Option to save to specific location

🎮 Usage Guide

Dialog Controls

Project Selection

  • ☑️ Checkboxes: Individual project selection with visual feedback
  • 🔗 Auto-Dependencies: Dependencies automatically selected when parent is checked
  • ⛓️ Auto-Dependents: Dependents automatically deselected when dependency is unchecked
  • 📊 Selection Counter: Real-time count showing "X of Y projects selected"

Bulk Operations

  • 🎯 Select All: Checks all selectable projects
  • 🗑️ Clear All: Unchecks all projects
  • 🧪 Select Tests: Smart selection of test projects (name contains "Test", "Spec", etc.)

Advanced Filtering

  • 🔍 Pattern Box: Wildcard filtering with real-time updates
  • ⚡ Live Filter: Filters as you type (300ms debounce)
  • 🧹 Clear Filter: Removes current filter pattern

Filter Examples:

*Test*      → Projects containing "Test"
Core*       → Projects starting with "Core"
*.Data      → Projects ending with ".Data"
*API*       → Projects containing "API"
Web*Service → Projects starting with "Web" and containing "Service"

Tree View Features

  • 🌳 Expand/Collapse All: Control dependency tree visibility
  • 🎨 Project Icons: Visual type indicators (C#, VB.NET, Web, Test, etc.)
  • 💡 Rich Tooltips: Detailed project information on hover
  • 📁 Path Display: Optional project path showing

🔧 Technical Implementation

Threading & Performance

// Async/await patterns throughout
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

// Background processing for heavy operations
ThreadHelper.JoinableTaskFactory.RunAsync(async () => {
    await ProcessSolutionAsync();
});

Dependency Resolution

// Multi-source dependency parsing
1. Solution-level dependencies (ProjectSection in .sln)
2. Project file references (<ProjectReference> in .csproj)
3. Transitive dependency calculation
4. Circular dependency detection

Error Handling Strategy

// Centralized error management
ErrorHandler.LogError("Operation failed", exception);
ErrorHandler.ShowUserError("Title", "Message", exception);

// Graceful degradation - continue on non-critical errors
// User-friendly error messages with technical details in logs

File Operations

// .NET 4.7.2 compatible async file operations
await FileUtils.ReadAllTextAsync(filePath);
await FileUtils.WriteAllTextAsync(filePath, content);

// Temp directory management
var tempDir = Path.Combine(Path.GetTempPath(), "FilteredSolutions");

🛠️ Building & Development

Prerequisites

  • Visual Studio 2022 with VSIX development workload
  • .NET Framework 4.7.2 SDK
  • Visual Studio SDK 17.0+

Build Process

# Clone repository
git clone <repository-url>

# Open in Visual Studio
# FilteredSolutionsExtension.sln

# Restore NuGet packages (automatic)
# Build solution (Ctrl+Shift+B)
# Output: bin/Debug/FilteredSolutionsExtension.vsix

Debugging

# Set VSIX project as startup
# Press F5 → launches VS experimental instance
# Open test solution to trigger extension
# Use Debug.WriteLine() and ErrorHandler.LogInfo()

Project Structure

FilteredSolutionsExtension/
├── 📁 Commands/           # VS menu commands
├── 📁 Converters/         # WPF value converters
├── 📁 Handlers/           # Event handlers & error management
├── 📁 Helpers/            # Core logic & utilities
├── 📁 Models/             # Data models & view models
├── 📁 Views/              # WPF dialogs & user controls
├── 📁 Assets/             # Icons, licenses, resources
├── 📁 Properties/         # Assembly info
└── 📁 Resources/          # Images & embedded resources

⚙️ Configuration

Current Settings

  • Auto-show filter dialog: ✅ Enabled
  • Remember selections: 🔄 Per solution (future)
  • Dependency auto-selection: ✅ Enabled
  • Temp directory usage: ✅ Enabled

Future Configuration Options

{
  "autoShowFilterDialog": true,
  "rememberLastSelection": true,
  "autoSelectDependencies": true,
  "showProjectPaths": false,
  "lastFilterPattern": "",
  "solutionFilterHistory": {}
}

🎨 UI/UX Features

Modern Design

  • Clean Interface: Minimal, focused design following VS2022 guidelines
  • Responsive Layout: Adapts to different screen sizes (minimum 1000x600)
  • Keyboard Support: Full keyboard navigation and shortcuts
  • Accessibility: Screen reader compatible with proper ARIA labels

Visual Feedback

  • Progress Indicators: Loading states and progress feedback
  • Status Updates: Real-time status bar information
  • Color Coding: Different colors for different project types
  • Icons: Rich iconography for project types and states

Performance Optimizations

  • Lazy Loading: Projects loaded asynchronously
  • Virtual Tree: Efficient tree rendering for large solutions
  • Debounced Filtering: Smooth filtering experience
  • Background Processing: Non-blocking UI operations

🔍 Troubleshooting

Common Issues & Solutions

❌ Dialog Doesn't Appear

Cause: Solution has only 1 project or is already filtered
Solution: Verify project count and check if solution is in temp directory
Debug: Check VS Output → General pane for extension logs

❌ Dependencies Not Working

Cause: Project references missing or incorrect
Solution: Verify .csproj <ProjectReference> entries
Debug: Use "Expand All" to visualize dependency tree

❌ Filtered Solution Won't Open

Cause: Missing project files or path issues
Solution: Ensure all projects exist and are accessible
Debug: Check temp directory and generated .sln file

❌ Performance Issues

Cause: Large solutions (100+ projects)
Solution: Use filtering to reduce scope before generation
Optimization: Close unnecessary VS instances

Debug Information

// Extension logging locations
var logPath = DebugHelper.GetLogPath();
// VS Output Window → General pane
// Windows Event Log → Application

🚧 Known Limitations

  1. Project Types: Works with standard MSBuild projects (.csproj, .vbproj)
  2. Solution Folders: Currently filtered out during parsing
  3. Complex References: Some advanced project configurations need manual adjustment
  4. Large Solutions: 100+ projects may experience slower parsing
  5. Network Drives: Performance better with local solutions

🔮 Future Enhancements

Planned Features

  • Settings Dialog: Full UI for configuration options
  • Solution Folder Support: Include/exclude solution folders
  • Template System: Save and load filter templates
  • Batch Processing: Filter multiple solutions at once
  • Git Integration: Filter based on changed files
  • Performance Dashboard: Build time analytics

Architecture Improvements

  • Plugin System: Extensible filter providers
  • Cloud Sync: Sync settings across machines
  • Analytics: Usage patterns and optimization suggestions
  • Integration: Better Solution Explorer integration

📊 Performance Metrics

Typical Performance

  • Small Solutions (5-20 projects): < 1 second parsing
  • Medium Solutions (20-50 projects): 1-3 seconds parsing
  • Large Solutions (50+ projects): 3-10 seconds parsing
  • Memory Usage: ~10-50MB additional during operation

Optimization Tips

  • Use filtering before selection to reduce scope
  • Close unnecessary Visual Studio instances
  • Work with local solutions when possible
  • Clear temp directory periodically

🤝 Contributing

Development Workflow

  1. Fork the repository
  2. Create feature branch (feature/amazing-feature)
  3. Follow existing code patterns and conventions
  4. Add comprehensive tests for new functionality
  5. Update documentation as needed
  6. Submit pull request with detailed description

Code Standards

  • Async/Await: Use modern async patterns
  • Error Handling: Comprehensive exception handling
  • Comments: Document complex logic and public APIs
  • Testing: Unit tests for core functionality
  • Performance: Consider impact on VS startup time

📜 License

This project is released under CC0 1.0 Universal (Public Domain). You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

🎉 Version History

1.0.0 - Initial Release (June 2025)

  • ✅ Core project filtering functionality
  • ✅ Automatic dialog on solution open
  • ✅ Manual filtering command
  • ✅ Smart dependency management
  • ✅ Pattern-based filtering with wildcards
  • ✅ Modern async/await architecture
  • ✅ Comprehensive error handling and logging
  • ✅ Save As functionality for custom locations
  • ✅ Expand/Collapse tree view controls
  • ✅ Rich project tooltips and visual feedback

💡 Pro Tips

Workflow Optimization

  • Start Small: Begin with core projects, add dependencies as needed
  • Use Patterns: Leverage *Test*, *Core*, *API* patterns for quick filtering
  • Save Templates: Use "Save As..." to create reusable filtered solutions
  • Monitor Dependencies: Use "Expand All" to understand project relationships

Performance Boosting

  • Targeted Selection: Select only projects you're actively developing
  • Test Isolation: Use "Select Tests" for focused testing sessions
  • Feature Branches: Create feature-specific filtered solutions
  • Build Optimization: Smaller solutions = faster builds and IntelliSense

Happy coding with cleaner, faster, more focused solutions! 🚀

The Filtered Solutions Extension transforms your Visual Studio experience by letting you work with exactly the projects you need, exactly when you need them.