# How to Ignore IDE0065 Error Message ## What is IDE0065? **IDE0065**: "Using directives must be placed outside of a namespace declaration" This is a code style warning about where `using` statements should be placed - inside or outside the namespace. ## Solutions Implemented ✅ ### Solution 1: .editorconfig (Applied) ✅ Updated `.editorconfig` to completely disable IDE0065: ```ini # IDE Rules - Suppress non-critical suggestions dotnet_diagnostic.IDE0065.severity = none ``` **Severity Levels:** - `none` = Completely disabled (doesn't appear anywhere) - `silent` = Hidden in IDE, but may show in build - `suggestion` = Shows as hint in IDE - `warning` = Shows as warning - `error` = Blocks build ### Solution 2: Project File (Applied) ✅ Added to `Emby.Naming.csproj`: ```xml $(NoWarn);IDE0065 ``` This ensures IDE0065 is completely suppressed during build. ## Additional Methods (If Needed) ### Method 3: Global Suppression File Create a file `GlobalSuppressions.cs` in your project: ```csharp // // Copyright (c) PlaceholderCompany. All rights reserved. // using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Style", "IDE0065:Misplaced using directive", Justification = "Project style preference")] ``` ### Method 4: Suppress for All Configurations If you want to suppress IDE0065 for **both Debug and Release**, add this to your `.csproj`: ```xml $(NoWarn);IDE0065 ``` ### Method 5: Visual Studio Settings (Local Only) If you only want to hide it in **your IDE** (doesn't affect builds): 1. Open Visual Studio 2. **Tools** → **Options** 3. **Text Editor** → **C#** → **Code Style** → **Formatting** 4. Under "Usings", set your preference 5. Or go to **Options** → **Environment** → **Task List** and filter warnings **Note:** This only affects your local IDE, not team builds. ## Verify the Changes ### Check in Visual Studio: 1. Restart Visual Studio (or reload solution) 2. Build the project 3. IDE0065 should no longer appear in Error List ### Check in Command Line: ```powershell # Clean and rebuild dotnet clean Emby.Naming\Emby.Naming.csproj dotnet build Emby.Naming\Emby.Naming.csproj # IDE0065 should not appear in output ``` ## What the Changes Mean ### For Your IDE: - ✅ IDE0065 will **not show** in the Error List - ✅ No underlines or suggestions in the code editor - ✅ Quick Actions (Ctrl+.) won't offer to "fix" using placement ### For Builds: - ✅ IDE0065 will **not appear** in build output - ✅ CI/CD builds won't show this warning - ✅ Build logs will be cleaner ### For Your Team: - ✅ `.editorconfig` is checked into source control - ✅ All developers will have the same suppression - ✅ Consistent experience across the team ## Why Both Methods? We applied **both** methods for maximum coverage: 1. **`.editorconfig`** → Suppresses in IDE and most build scenarios 2. **``** → Guarantees suppression during MSBuild/command-line builds This ensures IDE0065 is completely eliminated everywhere! ## Other Common IDE Errors to Suppress If you want to suppress other common warnings, add them to ``: ```xml $(NoWarn);IDE0065;IDE0008;IDE0058;SA1309;SA1101 ``` **Common Ones:** - `IDE0008` = Use explicit type instead of 'var' - `IDE0058` = Expression value is never used - `IDE0065` = Using directive placement - `SA1309` = Field names should not begin with underscore - `SA1101` = Prefix local calls with 'this' - `SA1200` = Using directives placement (StyleCop version) ## Testing After making these changes: ```powershell # 1. Clean everything dotnet clean # 2. Rebuild dotnet build Emby.Naming\Emby.Naming.csproj # 3. Check for IDE0065 in output (should be gone!) ``` Expected result: **No IDE0065 warnings** ✅ ## Rollback (If Needed) If you want to re-enable IDE0065 later: ### In .editorconfig: ```ini dotnet_diagnostic.IDE0065.severity = suggestion ``` ### In .csproj: Remove `IDE0065` from the `` list. ## Summary ✅ **Both methods applied!** - `.editorconfig` updated: `IDE0065.severity = none` - `Emby.Naming.csproj` updated: `$(NoWarn);IDE0065` **Result:** IDE0065 is now completely suppressed in: - ✅ Visual Studio IDE - ✅ Command-line builds - ✅ MSBuild - ✅ CI/CD pipelines You should no longer see IDE0065 anywhere! 🎉