Visual Studio : short cut Key : Duplicate Line

后端 未结 30 1309
[愿得一人]
[愿得一人] 2020-12-12 10:01

Is there a shortcut for Duplicate Line command in Visual Studio 2008?

Some similar examples:

  • in
相关标签:
30条回答
  • 2020-12-12 10:23

    In visual studio code (WebMatrix):

    Copy Lines Down: Shift + Alt + down

    Copy Lines Up: Shift + Alt + up

    Delete Lines: Ctrl + Shift + k

    0 讨论(0)
  • 2020-12-12 10:23

    In Visual Studio 2010 you copy the entire line the cursor is on with CTRL + INSERT then you can use Ctrl + V or SHIFT + INSERT to paste it.

    0 讨论(0)
  • 2020-12-12 10:24

    Why so many long drawn out methods to accomplish something so simple? It takes less than a minute to download and install the extension from Microsoft. The page says that it will bind it to ALT+D by default, but for me it bound it to CTRL+D automatically in Visual Studio Community 2015 without any changes.

    Here's the link to download the extension from Microsoft.com.

    0 讨论(0)
  • 2020-12-12 10:25

    I've been using the macro that Wael posted: Duplicate line command for Visual Studio, but it stopped working a week ago, I assumed because of a Windows update. And I was correct, as of February 2014, Macros have been disabled in VS2010 (and 2008 apparently).

    To fix this you'll either have to uninstall the security updates, or add one line of code into the config files as shown here.

    On a 64-bit Windows machine default paths to these files are:

    • C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\vsaenv10.exe.config
    • C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config

      ...
      <configuration>
          <runtime>
              <AllowDComReflection enabled="true"/>
              ...
      

      editor screenshot

    You MUST run your text editor with admin rights or it won't work! Hopefully this helps anyone else who suddenly has their macro functionality pulled out from underneath them.

    0 讨论(0)
  • 2020-12-12 10:26

    In Visual studio 2017 and maybe other version No need Macro or Extension,

    1. Go to Tools > Options > Environment > Keyboards
    2. Under Show commands containing: write Edit.Duplicate
    3. Place cursor to Press shortcut keys: and press Ctrl + D and click Assign button
    4. click OK to save your new keyboard shortcut

    0 讨论(0)
  • 2020-12-12 10:26

    I don't know if this exists in Visual Studio 2008 but in Visual Studio 2010+ you can easily do this by:

    Don't select anything, then press Ctrl + C And then (without doing anything else) Ctrl + V

    0 讨论(0)
提交回复
热议问题