简体   繁体   中英

Visual Studio 2022 automatically changes namespace when moving cs file to antoeher folder

VS started to "synchronize" the namespace of a file with the folder structure when moving files into another folder. I could not find a setting for this in the options menu and also searching for it online did not result in any useful information.

How can I turn this off?

VS info:

Microsoft Visual Studio Professional 2022
Version 17.4.3
VisualStudio.17.Release/17.4.3+33205.214
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA471
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.4.326.54890
ASP.NET and Web Tools

AvaloniaPackage Extension   1.0
AvaloniaPackage Visual Studio Extension Detailed Info

Azure App Service Tools v3.0.0   17.4.326.54890
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.4.326.54890
Azure Functions and Web Jobs Tools

C# Tools   4.4.0-6.22580.4+d7a61210a88b584ca0827585ec6e871c6b1c5a14
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Entity Framework Core Power Tools   2.5
Adds useful design-time EF Core DbContext features to the Visual Studio Solution Explorer context menu.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

NUKE Support   0.1.0
Task Runner integration for execution of targets and code snippets for authoring

Razor (ASP.NET Core)   17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62207.28050
Microsoft SQL Server Data Tools

Switch Startup Project   4.2.76
Provides a toolbar dropdown box  to switch between startup projects.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   17.0.10921.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.4.0-6.22580.4+d7a61210a88b584ca0827585ec6e871c6b1c5a14
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Unity   17.4.3.0
Visual Studio Tools for Unity

VsChromium   0.9.39
Collection of tools to help contributing code to the Chromium project.

VSColorOutput64   2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput

JetBrains ReSharper 2022.3.1 Build 223.0.20221218.114821 built on 2022-12-18
dotCover 2022.3.20221220.121240
dotTrace 2022.3.20221220.121254
ReSharper 2022.3.20221218.162156
dotMemory 2022.3.20221220.121254

The explanation document for this operation "enable namespace update when moving files" is here: Sync namespace and folder name .

You can find it and close it in the following operations.

Tools->Options->Projects and solutions->General->Enable namespace update when moving files

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM