Scaffolding Applications with .Net CLI
Basics
- dotnet restore : pulls in the dependencies needed by the application
- dotnet run : compiles and run the application
- dotnet build : compiles the application
- dotnet publish : packages up the files for reuse
Scaffolding
- dotnet new console -o ConsoleTest
- dotnet run (to run the application)
- dotnet build --force
- dotnet build --no-restore
- to add reference to the below classlib
- dotnet add reference “..\StringModifier.csproj”
- dotnet new classlib -o StringModifier
- dotnet build
- dotnet new mstest -o libraryTester
- add a reference to the abpove StringBuilder library
- dotnet add reference “..\StringModifier.csproj”
- create UnitTest.cs , reference the above and then test
- dotnet build
- dotnet test
- if [TestCategory(“SomeThing”)] applied to the tests then these could be run as
- dotnet test --filter TestCategory=SomeThing
- dotnet new mvc -o mvctest
- dotnet run
- will give you a port to run the app like
- dotnet build
- authentication
- dotnet new mvc -o mvcauth individual
- dotnet new webapi -o apidemo
- can add authentication just like above
- dotnet run
- this will give you the port
- dotnet new angular -o ngdemo
- install node js and then run npm
- dotnet run
- will give the port number
- Adding the EntityFramework Core
- dotnet add package Microsoft.EntityFrameworkCore.Design
- dotnet add package Microsoft.EntityFrameworkCore.Tools
- dotnet add package Microsoft.EntityFrameworkCore.SqlServer
- Following will be installing CLI tools
- >dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet
- Open up the .csproj file and add reference (VS Code IDE) to it if missing
- and finally restore by issuing the following command
- EF Migrations has an issue with SDK 3.0
- Other functions can that could be done via Scaffolding, check online for documentation
- Razor views
- Install nuget package "Microsoft.VisualStudio.Web.CodeGeneration.Tools", a good tool to have
- ReactJs
- xUnit test project
- Empty ASP.Net Core Apps
- Nuget packages
- MVC with no views