23ed81b6b1
- Add build-error-resolution.md guide for CS0006 and IDE analyzer issues - Add rebuild-solution.ps1 script for clean/reliable builds - Suppress noisy IDE/StyleCop warnings in .editorconfig - Optimize BaseItemRepository grouping queries to use Min(Id) instead of FirstOrDefault, avoiding correlated subqueries and greatly improving DB performance - Add database-query-optimization.md explaining query changes and tuning - Enable EF Core SQL query logging, sensitive data, and detailed errors when log level is Debug (ServiceCollectionExtensions, logging.json) - Update readme with SQL logging instructions - Clarify git commit/ignore guidance and improve inline documentation
6.0 KiB
6.0 KiB
Build Error Resolution Guide
Overview
This guide addresses the two main types of build issues in the Jellyfin solution:
- CS0006 Metadata Errors - Missing reference assemblies
- IDE#### Analyzer Warnings - Code style suggestions
1. CS0006 Metadata Errors (ACTUAL BUILD FAILURES)
Error Description
CS0006: Metadata file '...\obj\Debug\net11.0\ref\ProjectName.dll' could not be found
Cause
These errors occur when:
- Project build artifacts are corrupted or missing
- Projects are built out of order
- Incremental build state is invalid
- Clean operation didn't complete properly
Solution Options
Option A: Quick Rebuild (Recommended)
Run the provided PowerShell script:
.\rebuild-solution.ps1
Option B: Manual Steps in Visual Studio
- Build → Clean Solution
- Build → Rebuild Solution
If that doesn't work:
3. Close Visual Studio
4. Delete all bin and obj folders:
Get-ChildItem -Path . -Include bin,obj -Recurse -Directory | Remove-Item -Recurse -Force
- Reopen Visual Studio
- Build → Rebuild Solution
Option C: Build Projects in Order
If full rebuild fails, build these projects manually in order:
dotnet build "src\Jellyfin.Database\Jellyfin.Database.Implementations\Jellyfin.Database.Implementations.csproj"
dotnet build "src\Jellyfin.Database\Jellyfin.Database.Providers.Postgres\Jellyfin.Database.Providers.Postgres.csproj"
dotnet build "Jellyfin.Server.Implementations\Jellyfin.Server.Implementations.csproj"
dotnet build "Emby.Server.Implementations\Emby.Server.Implementations.csproj"
dotnet build "Jellyfin.Server\Jellyfin.Server.csproj"
dotnet build "Jellyfin.sln"
2. IDE#### Analyzer Warnings (CODE STYLE - NOT BUILD FAILURES)
Common IDE Warnings and What They Mean
| Code | Description | Severity | Action Taken |
|---|---|---|---|
| IDE0005 | Using directive is unnecessary | Silent | Suppressed |
| IDE0010 | Populate switch (add missing cases) | Silent | Suppressed |
| IDE0031 | Null check can be simplified | Silent | Suppressed |
| IDE0037 | Member name can be simplified | Silent | Suppressed |
| IDE0047 | Parentheses can be removed | Silent | Suppressed |
| IDE0055 | Fix formatting | Silent | Suppressed |
| IDE0060 | Remove unused parameter | Silent | Suppressed |
| IDE0100 | Remove redundant equality | Silent | Suppressed |
| IDE0370 | Suppression is unnecessary | Silent | Suppressed |
| IDE0004 | Cast is redundant | Silent | Suppressed |
StyleCop Warnings
| Code | Description | Severity | Action Taken |
|---|---|---|---|
| SA1118 | Parameter spans multiple lines | Silent | Suppressed |
Configuration
All IDE warnings have been suppressed in .editorconfig:
# IDE Rules - Suppress non-critical suggestions
dotnet_diagnostic.IDE0004.severity = silent
dotnet_diagnostic.IDE0005.severity = silent
dotnet_diagnostic.IDE0010.severity = silent
# ... etc
When Suppressions Take Effect
-
Visual Studio:
- Restart Visual Studio after modifying
.editorconfig - Or reload all projects: Right-click solution → Reload Projects
- Restart Visual Studio after modifying
-
Command Line:
- Changes apply immediately on next build
- May need to clean and rebuild for full effect
To See Warnings Again
If you want to see these warnings during development, change their severity:
# In .editorconfig
dotnet_diagnostic.IDE0055.severity = suggestion # Shows as suggestion
dotnet_diagnostic.IDE0055.severity = warning # Shows as warning
dotnet_diagnostic.IDE0055.severity = error # Causes build failure
3. Troubleshooting
Problem: .editorconfig Changes Not Taking Effect
Solution:
- Close Visual Studio
- Delete
.vsfolder in solution directory - Reopen Visual Studio
- Build → Rebuild Solution
Problem: Still Getting CS0006 Errors After Clean Build
Solution:
- Check if any projects failed to build:
dotnet build Jellyfin.sln --no-incremental - Look for actual compilation errors (not IDE warnings)
- Build failed projects individually
- Check for circular dependencies
Problem: Too Many Warnings Hiding Real Issues
Solution: Adjust severity levels to your preference:
none- Don't show at allsilent- Don't show in Error List, but still in editorsuggestion- Show as suggestion (···)warning- Show as warning (yellow)error- Show as error (red)
4. Build Script Usage
rebuild-solution.ps1
This script automates the clean and rebuild process:
# Run from solution root directory
.\rebuild-solution.ps1
What it does:
- Cleans the solution
- Removes all bin/obj directories
- Restores NuGet packages
- Rebuilds the entire solution
When to use:
- After switching branches
- After pulling changes that modify project files
- When getting CS0006 errors
- After modifying .csproj files
5. Git Considerations
Files to Commit
- ✅
.editorconfig- Code style settings - ✅
rebuild-solution.ps1- Build helper script - ✅
docs/build-error-resolution.md- This guide
Files to Ignore
- ❌
bin/directories (already in .gitignore) - ❌
obj/directories (already in .gitignore) - ❌
.vs/directory (already in .gitignore)
6. Summary
Quick Reference
CS0006 Errors (Build Failures):
# Quick fix
.\rebuild-solution.ps1
IDE Warnings (Code Style):
- Already suppressed in
.editorconfig - Restart Visual Studio if needed
- No action required for build
Build Status Check
After fixing errors, verify clean build:
dotnet build Jellyfin.sln --no-incremental
Expected output:
Build succeeded.
0 Warning(s)
0 Error(s)
Support
If you continue to experience issues:
- Check that you're using .NET 11 SDK
- Verify all NuGet packages restored successfully
- Check for antivirus interference with build process
- Try building in a fresh clone of the repository