ユーザ用ツール

サイト用ツール


サイドバー

dotnet:entityframeworkcoreをインストールする

Tutorial: Create a web API with ASP.NET Core

とりあえず開発用証明書を信頼する。

dotnet dev-certs https --trust

基本は下記コードを順番に実行すればよい。

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet tool install -g dotnet-aspnet-codegenerator
dotnet-aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers

dotnet tool install -g dotnet-aspnet-codegeneratorででるメッセージ通りに入力しないと使えないので注意

# dotnet tool install -g dotnet-aspnet-codegenerator
Tools directory '/root/.dotnet/tools' is not currently on the PATH environment variable.
If you are using bash, you can add it to your profile by running the following command:

cat << \EOF >> ~/.bash_profile
# Add .NET Core SDK tools
export PATH="$PATH:/root/.dotnet/tools"
EOF

You can add it to the current session by running the following command:

export PATH="$PATH:/root/.dotnet/tools"

You can invoke the tool using the following command: dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' (version '6.0.8') was successfully installed.

// ↓ cat...を入力
# cat << \EOF >> ~/.bash_profile
# Add .NET Core SDK tools
export PATH="$PATH:/root/.dotnet/tools"
EOF

// ↓ export...を入力
# export PATH="$PATH:/root/.dotnet/tools"
dotnet/entityframeworkcoreをインストールする.txt · 最終更新: 2022/09/06 20:35 by ips