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
- Solution Detection: Extension monitors
IVsSolutionEvents for solution opening
- Multi-Project Check: Only shows dialog for solutions with 2+ projects
- Background Loading: Waits for complete solution load using
OnAfterBackgroundSolutionLoadComplete
- Dialog Presentation: Shows interactive filter dialog with project tree
- Dependency Analysis: Parses project references from both .sln and .csproj files
- Smart Selection: Auto-selects dependencies when projects are checked
- Solution Generation: Creates filtered .sln file with proper path remapping
- Seamless Transition: Closes original and opens filtered solution
Manual Workflow
- Menu Access: File → "Filter Solution Projects..."
- Same Dialog: Uses identical filtering interface
- Current Solution: Filters the currently opened solution
- 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
- Project Types: Works with standard MSBuild projects (.csproj, .vbproj)
- Solution Folders: Currently filtered out during parsing
- Complex References: Some advanced project configurations need manual adjustment
- Large Solutions: 100+ projects may experience slower parsing
- 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
- Fork the repository
- Create feature branch (
feature/amazing-feature)
- Follow existing code patterns and conventions
- Add comprehensive tests for new functionality
- Update documentation as needed
- 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.