Visual Studio Code Duplicate Line Mac



Visual

  1. Visual Studio Code Duplicate Line Mac Version
  2. Visual Studio For Mac Tutorial
  3. Visual Studio Code Duplicate Line Mac Os

It miss an answer to this question, 'How to duplicate selection of code' Similar to Sublime's cmd / ctrl + shift + d or Jetbrains' cmd / ctrl + d behaviour. Install plugin Duplicate selection or line from VS Code Marketplace This extension provides bindings for ctrl + d (Windows/Linux) and cmd + d (MacOS). This topic applies to Visual Studio on Windows. For Visual Studio for Mac. Duplicate line: Ctrl+E,V. Toggle between the code editor window and the Peek.

-->

This tutorial shows how to publish a console app so that other users can run it. Publishing creates the set of files that are needed to run an application. To deploy the files, copy them to the target machine.

The .NET CLI is used to publish the app, so you can follow this tutorial with a code editor other than Visual Studio Code if you prefer.

Prerequisites

  • This tutorial works with the console app that you create in Create a .NET console application using Visual Studio Code.

Publish the app

  1. Start Visual Studio Code.

  2. Open the HelloWorld project folder that you created in Create a .NET console application using Visual Studio Code.

  3. Choose View > Terminal from the main menu.

    The terminal opens in the HelloWorld folder.

  4. Run the following command:

    The default build configuration is Debug, so this command specifies the Release build configuration. The output from the Release build configuration has minimal symbolic debug information and is fully optimized.

    The command output is similar to the following example:

Inspect the files

By default, the publishing process creates a framework-dependent deployment, which is a type of deployment where the published application runs on a machine that has the .NET runtime installed. To run the published app you can use the executable file or run the dotnet HelloWorld.dll command from a command prompt.

Duplicate

In the following steps, you'll look at the files created by the publish process.

  1. Select the Explorer in the left navigation bar.

  2. Expand bin/Release/net5.0/publish.

    As the image shows, the published output includes the following files:

    • HelloWorld.deps.json

      This is the application's runtime dependencies file. It defines the .NET components and the libraries (including the dynamic link library that contains your application) needed to run the app. For more information, see Runtime configuration files.

    • HelloWorld.dll

      This is the framework-dependent deployment version of the application. To execute this dynamic link library, enter dotnet HelloWorld.dll at a command prompt. This method of running the app works on any platform that has the .NET runtime installed.

    • HelloWorld.exe (HelloWorld on Linux, not created on macOS.)

      This is the framework-dependent executable version of the application. The file is operating-system-specific.

    • HelloWorld.pdb (optional for deployment)

      This is the debug symbols file. You aren't required to deploy this file along with your application, although you should save it in the event that you need to debug the published version of your application.

    • HelloWorld.runtimeconfig.json

      This is the application's run-time configuration file. It identifies the version of .NET that your application was built to run on. You can also add configuration options to it. For more information, see .NET run-time configuration settings.

Visual Studio Code Duplicate Line Mac Version

Run the published app

  1. In Explorer, right-click the publish folder (Ctrl-click on macOS), and select Open in Terminal.

  2. On Windows or Linux, run the app by using the executable.

    1. On Windows, enter .HelloWorld.exe and press Enter.

    2. On Linux, enter ./HelloWorld and press Enter.

    3. Enter a name in response to the prompt, and press any key to exit.

  3. On any platform, run the app by using the dotnet command:

    1. Enter dotnet HelloWorld.dll and press Enter.

    2. Enter a name in response to the prompt, and press any key to exit.

Additional resources

Next steps

In this tutorial, you published a console app. In the next tutorial, you create a class library.

Visual Studio For Mac Tutorial

ReSharper | Edit | Duplicate Text
Control+D
ReSharper_DuplicateText

One of the ways of creating a code element similar to an existing one (for example, a new method overload or a new auto-implemented property) is cloning the existing element with copy-paste and then editing the clone.

ReSharper helps you streamline the cloning part — with a single keystroke Control+D the cloned code is inserted right after the original.

Quickly duplicate the current line or selection

  1. If you want to clone a line, set the caret at this line line. To clone an arbitrary piece of code, select it in the editor.

    To select a logical code block, press Control+W one or more times; to select the current declaration, press Control+Shift+OemOpenBrackets.

  2. Press Control+D or choose ReSharper | Edit | Duplicate Text from the main menu. Alternatively, you can press Control+Shift+A, start typing the command name in the popup, and then choose it there.

  3. The duplicated line or multi-line selection is inserted below the original line or selection; the duplicated inline selection is inserted to the right of the original.

  4. If you have duplicated a selection, the selection stays at the clone. If necessary, you can press Ctrl+Shift+Alt and then use arrow keys to move the clone to the desired position.

Visual

This feature is supported in the following languages and technologies:

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Visual Studio Code Duplicate Line Mac Os

Last modified: 08 March 2021