4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

.NET Core に関するメモ (2017年10月)

Last updated at Posted at 2017-10-18

まとまってるのがあまりなかったので.....
.NET Core 使う際の自分用メモ
現在の最新は.Net Core 2.0

インストール

  1. Windwos
    ダウンロードしてインストールするだけ
    https://www.microsoft.com/net/core#windowscmd
  2. Ubuntu
    パッケージの追加
    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
    インストールはUbuntuのバージョンごとに微妙に違う
    Ubuntu 17.04
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-zesty-prod zesty main" > /etc/apt/sources.list.d/dotnetdev.list'
    Ubuntu 16.04
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
    Ubuntu 14.04
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    あとはいつも通り
    sudo apt-get update
    sudo apt-get install dotnet-sdk-2.0.0

新規プロジェクト/ファイルの作成

  1. Console Application
    dotnet new console -o hogehoge
  2. Class library
    dotnet new classlib -o hogehoge
  3. Unit Test Project
    dotnet new mstest -o hogehoge
  4. xUnit Test Project
    dotnet new xunit -o hogehoge
  5. ASP.NET Core Empty
    dotnet new web -o hogehoge
  6. ASP.NET Core Web App (Model-View-Controller)
    dotnet new mvc -o hogehoge
  7. ASP.NET Core Web App
    dotnet new razor -o hogehoge
  8. ASP.NET Core with Angular
    dotnet new angular -o hogehoge
  9. ASP.NET Core with React.js
    dotnet new react -o hogehoge
  10. ASP.NET Core with React.js and Redux
    dotnet new reactredux -o hogehoge
  11. ASP.NET Core Web API
    dotnet new webapi -o hogehoge
  12. global.json file
    dotnet new globaljson -o hogehoge
  13. Nuget Config
    dotnet new nugetconfig -o hogehoge
  14. Web Config
    dotnet new webconfig -o hogehoge
  15. Solution File
    dotnet new sln -o hogehoge
  16. Razor Page
    dotnet new page -o hogehoge
  17. MVC ViewImports
    dotnet new viewimports -o hogehoge
  18. MVC ViewStart
    dotnet new viewstart -o hogehoge

パッケージの追加(Nugetなど)

dotnet add package hogehoge

依存ファイルの復元(反映?)

Configファイル書き直した場合などに
dotnet restore

起動

dotnet run

まとめ

.NetCore に限らないけど困ったら-hすればなんとかなったりする。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?