Skip to content

Instantly share code, notes, and snippets.

@shturm
Last active September 6, 2023 07:41
Show Gist options
  • Save shturm/9b7c418b8199f7f1ea7e8013fbb81857 to your computer and use it in GitHub Desktop.
Save shturm/9b7c418b8199f7f1ea7e8013fbb81857 to your computer and use it in GitHub Desktop.
DotNetCore 6/7 ASP.NET CLI cheatsheet

Create new asp.net site with SQLite database dotnet new mvc -au Individual

Cross compile on Windows for Ubuntu: dotnet publish --runtime ubuntu.22.04-x64 -c Release then to run it dotnet myprojname.dll

Create a minimal dotnet 7 app with anonymous function for endpoints dotnet new web

Install tools

dotnet tool install --global dotnet-ef

dotnet add package Microsoft.EntityFrameworkCore.Design

dotnet tool update -g dotnet-aspnet-codegenerator

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

Generate Identity Razor pages for easy overriding dotnet aspnet-codegenerator identity -u User

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment