Files
pgsql-jellyfin/docs/HOW_TO_IGNORE_IDE0065.md
wjones 534b0cde91 Ensure initial user exists before startup wizard completes
Add logic to initialize at least one user if the startup wizard is not completed, both during application startup and in the startup user API. After user creation, reload the user entity with all related navigation properties to ensure the in-memory user object is fully populated. Also update build and publish metadata files.
2026-02-23 15:42:19 -05:00

4.5 KiB

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:

# 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:

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
  <NoWarn>$(NoWarn);IDE0065</NoWarn>
</PropertyGroup>

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:

// <copyright file="GlobalSuppressions.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

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:

<PropertyGroup>
  <NoWarn>$(NoWarn);IDE0065</NoWarn>
</PropertyGroup>

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. ToolsOptions
  3. Text EditorC#Code StyleFormatting
  4. Under "Usings", set your preference
  5. Or go to OptionsEnvironmentTask 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:

# 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. <NoWarn> → 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 <NoWarn>:

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
  <NoWarn>$(NoWarn);IDE0065;IDE0008;IDE0058;SA1309;SA1101</NoWarn>
</PropertyGroup>

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:

# 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:

dotnet_diagnostic.IDE0065.severity = suggestion

In .csproj:

Remove IDE0065 from the <NoWarn> list.

Summary

Both methods applied!

  • .editorconfig updated: IDE0065.severity = none
  • Emby.Naming.csproj updated: <NoWarn>$(NoWarn);IDE0065</NoWarn>

Result: IDE0065 is now completely suppressed in:

  • Visual Studio IDE
  • Command-line builds
  • MSBuild
  • CI/CD pipelines

You should no longer see IDE0065 anywhere! 🎉