setting up C# project with VSCode
# Setting up C# project with VSCode:
# 1. Open File Explorer and create a folder on your disk, then select the
# file path and to open the Command Prompt at the current path, type: cmd
# (For the purpose of this guide, the folder is called 'MyFolder')
# The Command Prompt should look like this:
Microsoft Windows [Version 10.0.19043.1165]
(c) Microsoft Corporation. All rights reserved.
C:\Users\name\MyFolder>
# 2. Create .sln file and check the directory.
C:\Users\name\MyFolder>dotnet new sln -n "SlnFileName"
C:\Users\name\MyFolder>dir
# ('dir' shows the directory for current folder so you
# can check to see any files/folders updates)
# 3. Create new console project folder and check the directory.
C:\Users\name\MyFolder>dotnet new console -n "ProjectName"
C:\Users\name\MyFolder>dir
# 4. Create class library folder and check the directory.
C:\Users\name\MyFolder>dotnet new classlib -n "LibraryName"
C:\Users\name\MyFolder>dir
# 5. Add project to solution.
C:\Users\name\MyFolder>dotnet sln SlnFileName.sln add ./ProjectName/ProjectName.csproj
# 6. Add library to solution.
C:\Users\name\MyFolder>dotnet sln SlnFileName.sln add ./LibraryName/LibraryName.csproj
# 7. Project references the library.
C:\Users\name\MyFolder>dotnet add ProjectName/ProjectName.csproj reference LibraryName/LibraryName.csproj
# 8. Move the command line into a new project folder and check the directory.
C:\Users\name\MyFolder>cd ProjectName
C:\Users\name\MyFolder\ProjectName>dir
# 9. Launch VSCode from cmd. This will open VSCode with the current folder
# already open. When VSCode has launched, there should be a little pop-up
# message in the bottom right of the screen saying 'Required assets to
# build and debug are missing from 'ProjectName'. Add them?'. You want to
# click 'Yes' to add 'launch.json' and 'tasks.json' files.
C:\Users\name\MyFolder\ProjectName>Code ..
# 10. Now, close VSCode. In cmd, go back one folder, to 'MyFolder'.
# Lastly, open VSCode. Your default 'Program.cs' file should be located
# in the 'ProjectName' folder.
C:\Users\name\MyFolder\ProjectName>cd ..
C:\Users\name\MyFolder>Code ..
# Please comment if you have any queries, or contact me (EAJB) on the Slack
# community.
Are there any code examples left?
New code examples in category Shell/Bash
-
Shell/Bash 2022-03-27 22:30:33 wise highlight ubuntu
-
Shell/Bash 2022-03-27 22:25:19 how to send a pull request in git
-
Shell/Bash 2022-03-27 21:55:06 how to open terminal in sublime text ubuntu
-
Shell/Bash 2022-03-27 21:25:19 how to switch branch
-
Shell/Bash 2022-03-27 21:20:25 python
-
Shell/Bash 2022-03-27 21:20:04 set user as admin gitlab
-
Shell/Bash 2022-03-27 21:10:09 apache2 mod_jk proxy to tomcat connector
-
Shell/Bash 2022-03-27 20:35:12 chown
-
Shell/Bash 2022-03-27 20:15:08 awk last match