Top

Ubuntu 18.04 LTS에서 C#으로 개발 하기

2019년 4월 2일

VSCode 설치

이 페이지의 공식 문서에 따라 VSCode를 설치합니다.

.NET Core 2.2 설치

이 페이지의 안내에 따라 .NET Core SDK를 설치합니다.

VSCode에 C# Extension 설치

VSCode를 실행하고 마켓플레이스에서 C# Extension을 설치합니다.

예제 만들기

콘솔을 열어 원하는 폴더에 프로젝트 폴더를 만듭니다.

mkdir cshello
cd cshello
git init

.NET Core 콘솔 프로젝트를 만듭니다.

dotnet new console

ls명령으로 폴더를 확인하면 두개의 파일과 하나의 폴더가 생성되어 있습니다.

obj					Program.cs			cshello.csproj

여기서 obj는 중간파일이 보관되며 Program.cs는 Hello world!를 출력하는 코드입니다.

using System;

namespace sharpcraw
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

실행합니다.

dotnet run

Hello world! 메시지가 출력 됩니다.

다시 ls로 폴더를 확인 합니다.

bin					obj					Program.cs			cshello.csproj

새로 bin폴더가 생성되었으며 이 폴더에는 실행을 위한 최종 파일들이 구성이나 버전에 따라 있습니다.

디버그

이 페이지의 공식 문서에 따라 디버그를 합니다.

.gitignore

이 문서에 따라 .gitignore를 생성합니다.

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.svclog
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml
*.azurePubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
## TODO: If the tool you use requires repositories.config, also uncomment the next line
!packages/repositories.config

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
![Ss]tyle[Cc]op.targets
~$*
*~
*.dbmdl
*.[Pp]ublish.xml

*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

_NCrunch*

참조