简体   繁体   English

将 cs 文件移动到 antoeher 文件夹时,Visual Studio 2022 会自动更改命名空间

[英]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.将文件移动到另一个文件夹时,VS 开始“同步”文件的命名空间和文件夹结构。 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工具->选项->项目和解决方案->常规->移动文件时启用命名空间更新

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我直接将文件粘贴到解决方案的文件夹中时,Visual Studio 2008 tfs自动生成.cs文件 - Visual Studio 2008 tfs automatically generating .cs file when i directly paste file into solution's folder 打开 .cs 文件时的 Visual Studio 2022 未经授权的操作 - Visual Studio 2022 Unauthorized Operation when opening .cs files 从其他地方复制代码后如何停止Visual Studio 2022自动添加命名空间 - How to stop Visual Studio 2022 to add namespace automatically after copy codes from other place 用户控件命名空间错误visual studio 2022 - Usercontrol namespace error visual studio 2022 在文件夹中创建类时更改默认命名空间 (Visual Studio) - Change Default Namespace when creating Class in Folder (Visual Studio) Visual Studio 2022 WinForm 发布文件夹 - Visual studio 2022 WinForm publish folder 如何在 Visual Studio 2022 预览版中禁用 CS1514 - How to disable CS1514 in Visual Studio 2022 preview 如何从 Visual Studio 2022 中的命名空间中删除花括号 - how to remove curly braces from a namespace in visual studio 2022 每当我添加新的CS文件时,Visual Studio就会在重复的解决方案中继承旧的名称空间 - Visual Studio inherits old namespace in a duplicated solution each time I add new cs file Visual Studio 2017 禁用文件夹命名空间 - Visual Studio 2017 disable folder namespace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM