简体   繁体   English

如何在 Visual Studio 2017 中禁用自动 ID

[英]How to disable Auto ID in Visual Studio 2017

When copying and pasting HTML, VS helpfully renames all my variables to things like "Div1" & "Img1".复制和粘贴 HTML 时,VS 将我所有的变量重命名为“Div1”和“Img1”之类的东西。 Why!为什么!

I remember when using VS 2010 I think it was, there was a setting that allowed us to turn this "feature" off.我记得在使用 VS 2010 时,我认为是的,有一个设置允许我们关闭这个“功能”。 Seems that feature no longer exists.似乎该功能不再存在。

Are there any plugins or extensions or workarounds for this problem?是否有任何插件或扩展或解决此问题的方法?

Seems that people have been complaining about this for years now:似乎人们多年来一直在抱怨这一点:

How do I prevent Visual Studio from renaming my controls? 如何防止 Visual Studio 重命名我的控件?

Disable "Auto ID elements" in Visual Studio 2013 在 Visual Studio 2013 中禁用“自动 ID 元素”

https://connect.microsoft.com/VisualStudio/feedback/details/806446/asp-net-web-forms-development-unable-to-disable-auto-id-generation-on-paste-using-new-version-of-visual-studio-2013 https://connect.microsoft.com/VisualStudio/feedback/details/806446/asp-net-web-forms-development-unable-to-disable-auto-id-generation-on-paste-using-new-version- of-visual-studio-2013

You can use the following command (Language: C#) for my Visual Commander extension to paste text as is without renaming variables:您可以对我的Visual Commander扩展使用以下命令(语言:C#)来按原样粘贴文本,而无需重命名变量:

public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
    EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
    ts.Insert(System.Windows.Clipboard.GetText());
}

Here is the simplest workaround.这是最简单的解决方法。
Simply make a comment first, then paste into the comment.只需先发表评论,然后粘贴到评论中。 When uncommenting, it will not apply Auto ID.取消注释时,它不会应用 Auto ID。

As a keyboard shortcut, it's CTRL+K,C,V,K,U on a new line.作为键盘快捷键,它是 CTRL+K,C,V,K,U 换行。
Comment (KC), Paste (V), Uncomment (KU).评论 (KC)、粘贴 (V)、取消评论 (KU)。

您可以在“选项”>“文本编辑器”>“HTML”中禁用此自动标记关闭,您可以在此处找到有关 html 编辑器的所有信息。在粘贴时搜索 AutoTag 或 Format Html!

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

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