There are 3 templates for each of the different technologies that can be used with ServiceStack to develop Server HTML Generated Websites and HTTP APIs which can be installed with dotnet-new:
$ dotnet tool install --global x
Which will create a new .NET 6.0 MVC Project called AcmeMvc. The Template Names, Source Code and Live Demos for each Website Template is available below:
|.NET 6.0||.NET Framework||Single Page App Templates|
|mvc||mvc-netfx|| MVC Bootstrap Template |
| The |
mvc template differentiates the most between .NET Core and ASP.NET versions as ASP.NET Core MVC and ASP.NET MVC 5 are completely different implementations. With
mvc ServiceStack is configured within the same .NET Core pipeline and shares the same request pipeline and “route namespace” but in ASP.NET MVC 5, ServiceStack is hosted at the
/api Custom Path. Use MVC if you prefer to create different Controllers and View Models for your Website UI independently from your HTTP APIs or if you prefer to generate server HTML validation errors within MVC Controllers.
|razor||razor-netfx|| ServiceStack.Razor Bootstrap Template |
| The |
razor Template is configured to develop Websites using ServiceStack.Razor for developing server-generated Websites using Razor without MVC Controllers which lets you create Content Razor Pages that can be called directly or View Pages for generating HTML Views for existing Services. The source code for .NET Core and ASP.NET Framework projects are nearly identical despite being completely different implementations with the .NET Core version being retrofitted on top of .NET Core MVC Views. Use
razor templates if you like Razor and prefer the API First Development model or plan on developing Websites for both .NET Core and ASP.NET and would like to be easily able to migrate between them.
|script||script-netfx|| ServiceStack #Script Pages Bootstrap Template |
| The |
script Project Template is configured to develop Websites using #Script Pages, a simpler and cleaner alternative to Razor that lets you utilize simple #Script Expressions for evaluating Server logic in
.html pages. #Script doesn’t require any precompilation, is easier to learn and more intuitive for non-programmers that’s more suitable for a number of use-cases. Use
script if you want an alternative to Razor syntax and the heavy machinery required to support it.
script project enjoy Hot Reloading where in development a long poll is used to detect and reload changes in the current Template Page or static files in
Watched .NET Core builds
.NET Core projects can also benefit from Live Coding using dotnet watch which performs a "watched build" where it automatically stops, recompiles and restarts your .NET Core App when it detects source file changes. You can start a watched build from the command-line with:
.NET 6.0 ServiceStack WebApp Template
The .NET 6.0 bare-app project template is a pre-built .NET 6.0 App that dramatically simplifies .NET Wep App development by enabling Websites and APIs to be developed instantly without compilation.
See sharpscript.net/docs/sharp-apps to learn the different use-cases made possible with Sharp Apps.