Visual studio code csharp

Начало работы с VS Code с помощью C# и .NET Core в Windows

Это краткое руководство по началу работы с C# в VS Code в Windows с .NET Core.

Привет, это видео учебник для

Сначала перейдите в избранное

поиск в поисковой системе и поиск

быть одним из первых результатов.

у нас также есть скачиваемые файлы для

Нажмите кнопку Да, чтобы запустить, и

Для тех из вас, кто не знает,

Visual Studio Code является упрощенным

кроссплатформенный редактор исходного кода

поддерживает несколько языков;

встроенный элемент управления Git,

выделение синтаксиса и многое другое.

Это полностью бесплатно и

с открытым исходным кодом на GitHub.

он откроется Visual Studio Code.

установите расширение C#, оно будет

быть одним из первых предложений.

Вы также можете найти много

другие прохладные расширения там.

Теперь, когда у нас есть vs code,

нам потребуется .NET Core для компиляции C#.

Поэтому вернитесь в браузер и

быть одним из первых результатов.

Так как я не использую Visual Studio,

Я использую Visual Studio Code,

Все, что мне нужно сделать здесь, это

скачайте пакет SDK для .NET Core.

Я могу найти пакет SDK для .NET Core

скачать на вкладке Командная строка.

Поэтому щелкните exe-файл и щелкните

с помощью установщика .NET Core.

вы можете использовать .NET Core с

любой нужный редактор исходного кода.

Я выбрал VS Code, потому что

инициализация приложения .NET.

Вы можете найти эти инструкции

Я хочу, чтобы мой проект был в.

При этом создается базовая консоль

приложение в каталоге с именем MyApp.

Теперь я могу ввести период кода для открытия

мой проект в Visual Studio Code.

загрузка OmniSharp в отладчике.

Теперь я могу открыть интегрированную

введя обратный символ CTRL.

И я запустю восстановление .NET.

Появятся всплывающие окна с запросом «Да»

для скачивания требуемой заготовки

ресурсы и для восстановления.

Теперь я могу ввести .NET run в

терминал для запуска приложения.

Круто, так что давайте сделаем это вечеринкой и

инициализация приложения asp.netcore и

type dotnet new mvc -au none

Параметр -au none указывает

без проверки подлинности, и

Так что я открою это в VS Code

путем повторного ввода точки кода.

И вы можете увидеть в Интернете

И есть эти всплывающие окна снова

для загрузки ресурсов сборки и восстановления.

Так что теперь я открою терминал

Теперь, когда он работает, я могу перейти к

my localhost 5000 в браузере и

просмотр веб-приложения, которое

Я только что инициализировал.

Демонстрация для базового

ASP.NET приложения контроллера представления модели,

создается менее чем за пять минут.

Это краткое руководство по началу работы с C# в VS Code в Windows с .NET Core.

Привет, это видео учебник для

Сначала перейдите в избранное

поиск в поисковой системе и поиск

быть одним из первых результатов.

у нас также есть скачиваемые файлы для

Нажмите кнопку Да, чтобы запустить, и

Для тех из вас, кто не знает,

Visual Studio Code является упрощенным

кроссплатформенный редактор исходного кода

поддерживает несколько языков;

встроенный элемент управления Git,

выделение синтаксиса и многое другое.

Это полностью бесплатно и

с открытым исходным кодом на GitHub.

он откроется Visual Studio Code.

установите расширение C#, оно будет

быть одним из первых предложений.

Вы также можете найти много

другие прохладные расширения там.

Теперь, когда у нас есть vs code,

нам потребуется .NET Core для компиляции C#.

Поэтому вернитесь в браузер и

быть одним из первых результатов.

Так как я не использую Visual Studio,

Я использую Visual Studio Code,

Все, что мне нужно сделать здесь, это

скачайте пакет SDK для .NET Core.

Я могу найти пакет SDK для .NET Core

скачать на вкладке Командная строка.

Поэтому щелкните exe-файл и щелкните

с помощью установщика .NET Core.

вы можете использовать .NET Core с

любой нужный редактор исходного кода.

Я выбрал VS Code, потому что

инициализация приложения .NET.

Вы можете найти эти инструкции

Я хочу, чтобы мой проект был в.

При этом создается базовая консоль

приложение в каталоге с именем MyApp.

Теперь я могу ввести период кода для открытия

мой проект в Visual Studio Code.

загрузка OmniSharp в отладчике.

Теперь я могу открыть интегрированную

введя обратный символ CTRL.

И я запустю восстановление .NET.

Появятся всплывающие окна с запросом «Да»

для скачивания требуемой заготовки

ресурсы и для восстановления.

Теперь я могу ввести .NET run в

терминал для запуска приложения.

Круто, так что давайте сделаем это вечеринкой и

инициализация приложения asp.netcore и

type dotnet new mvc -au none

Параметр -au none указывает

без проверки подлинности, и

Так что я открою это в VS Code

путем повторного ввода точки кода.

И вы можете увидеть в Интернете

И есть эти всплывающие окна снова

для загрузки ресурсов сборки и восстановления.

Так что теперь я открою терминал

Теперь, когда он работает, я могу перейти к

my localhost 5000 в браузере и

просмотр веб-приложения, которое

Я только что инициализировал.

Демонстрация для базового

ASP.NET приложения контроллера представления модели,

создается менее чем за пять минут.

Источник

Getting Started with C# in VS Code

This getting started guide introduces you to C# and .NET for Visual Studio Code through the following tasks:

  1. Installing and setting up your VS Code environment for C#.
  2. Writing and running a simple «Hello World» application using C#.
  3. Introduce you to other learning resources for C# in VS Code.

Keep in mind, that this guide won’t teach you C#. Instead, it teaches you how to get set up for C# development in VS Code. If you’re looking for resources to learn C#, check out our C# curriculum.

Necessary tools

Install

Installing VS Code and extensions

  1. If you haven’t already done so, install VS Code.
  2. Next, install C# Dev Kit from the Visual Studio Marketplace. For additional details on installing extensions, read Extension Marketplace. The C# extension is called C# Dev Kit and it’s published by Microsoft.

Note: C# Dev Kit supports cloud native development. To do cross-platform mobile and desktop development, you can use C# Dev Kit with the .NET MAUI extension. Learn how to get set up with .NET MAUI in VS Code.

Upon installation, C# Dev Kit launches an extension walkthrough. You can follow the steps of this walkthrough to learn more about the features of the C# extension. Reopen the walkthrough at any time by opening the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) and selecting Welcome: Open Walkthrough. Here, select Get Started with C# Dev Kit.

Note: You are required to sign in to a Visual Studio subscription to use C# Dev Kit. Check out the Signing in to C# Dev Kit documentation to learn more.

Installing the .NET Coding Pack for students

If you’re a student, we recommend installing the .NET Coding Pack for an easier setup experience. The Coding Pack includes VS Code, the .NET SDK, and essential .NET extensions. The Coding Pack can be used as a clean installation, or to update or repair an existing development environment.

Note: The .NET Coding Pack is only available for Windows and macOS. For other operating systems, you need to manually install the .NET SDK, VS Code, and .NET extensions.

Open folder

By starting VS Code in a folder, that folder becomes your «workspace». VS Code stores settings that are specific to that workspace in .vscode/settings.json , which are separate from user settings that are stored globally.

Using a terminal, create an empty folder called «hello», navigate into it, and open VS Code (code) in that folder (.) by entering the following commands:

mkdir hello cd hello code . 

Alternatively, you can run VS Code through the operating system UI, then use File > Open Folder to open the project folder.

Create a Hello World app

First, ensure you are within the new folder (workspace) that you created. From here, you can create the project in two ways.

Use the Command Palette

  1. Bring up the Command Palette using ⇧⌘P (Windows, Linux Ctrl+Shift+P ) and then type «.NET».
  2. Find and select the .NET: New Project command.
  3. After selecting the command, you’ll need to choose the project template. Choose Console app.
  4. To run your app, select Run > Start Debugging in the upper menu, or use the F5 keyboard shortcut. To learn more about debugging your C# project, read the debugging documentation.

Use the terminal

  1. Open a terminal/command prompt and navigate to the folder in which you’d like to create the app. Enter the following command in the command shell:

Learn more

Explore all the features the C# extension has to offer by looking for .NET in the Command Palette. For more information on these features, refer to the other documentation pages.

For learning materials on C# and .NET, check out the following resources:

Join the community

Find community resources and connect with user groups.

.NET developer community — Meet with like-minded developers

Источник

The navigation and editing tools described in this overview are enabled by the C# Dev Kit extension, a lightweight extension to enhance your C# development experience in Visual Studio Code.

Code Navigation

With the Outline view, you can conveniently navigate the members within the current file. Installing the C# Dev Kit extension also gives you the Solution Explorer view. This view helps you add, manage, and modify your projects contained within a larger solution without switching between the command line and the editor.

Go To Definition

The Go To Definition feature navigates to the source or file of a type or member, and opens the result in a new tab. If you are a keyboard user, place your text cursor somewhere inside the symbol name and press F12 . If you are a mouse user, either right-click the symbol name and select Go To Definition from the context menu or Ctrl+click the symbol name. You can also use Ctrl+Alt+click to open the definition on the side.

Peek Definition

You can take a quick look at how a symbol was defined by using the Peek Definition feature. This feature displays a few lines of code near the definition inside a peek window, so you can take a look without navigating away from your current location.

To peek at a symbol’s definition, place your cursor on the symbol anywhere it’s used in your source code and then press ⌥F12 (Windows Alt+F12 , Linux Ctrl+Shift+F10 ) . Alternatively, you can choose Peek Definition from the context menu (right-click, then choose Peek > Peek Definition).

Peek Implementations

You can take a quick, inline view at how and where a class, method, or symbol was implemented using the Peek Implementations feature.

To view the list of implementation locations, place the cursor on the symbol anywhere it’s used in your source code and then press ⇧⌘F12 (Windows, Linux Ctrl+Shift+F12 ) . Alternatively, you can choose Peek Implementations from the context menu (right-click, then choose Peek > Peek Implementations).

Peek References

You can get an inline list of sources where a selected symbol has been referenced in your code using the Peek References feature. Place the cursor on the symbol anywhere it’s used in your source code, right-click, then choose Peek > Peek References.

Collapse or expand code snippets

To better view the source code, hover over the editor gutter to collapse or expand code snippets using the caret that appears.

Smart selection

With smart selection (semantic selection), you can expand or shrink the selection range based on the semantic information of the caret position in your source code.

  • To expand the selection, use ⌃⇧⌘→ (Windows, Linux Shift+Alt+Right )
  • To shrink the selection, use ⌃⇧⌘← (Windows, Linux Shift+Alt+Left )

Источник

Читайте также:  My Audio
Оцените статью