ASP.NET Core Starter App Built on MacOS: An Introduction
Recently, I helped a group of university students with their capstone project, addressing a business problem for a real client. The project used ASP.NET Core MVC, and we ran into some challenges. This post is the first in a series that sets up the project, the challenges, and the solutions we pieced together that will help you get started in ASP.NET Core development outside the traditional Windows/Visual Studio development toolchain.
Background of the Project
The students built an app intended to be used by the university’s theater department to inventory costumes and set pieces for the different shows they perform. Eventually, the goal was to share the app with other universities and local theater groups so when costumes and set pieces are lent/borrowed between organizations, they are more easily tracked.
We built this project using ASP.NET Core MVC. As someone with very little C#/.NET development experience, and with myself and several others in the class using Apple laptops as development machines, we ran into some interesting challenges. We addressed what I perceived to be shortcomings in the Microsoft tutorials and starter app examples. We pieced together many solutions that are helpful for getting started in ASP.NET Core development outside of the traditional Windows/Visual Studio development toolchain, and/or for those accustomed to some of the pre-configured tooling of other frameworks.
This post is the first in a series that will cover details and examples of:
- getting a project up and running
- swapping out default tools (replacing jQuery and Bootstrap with Vue.js and Bulma)
- building simple front-end components within Razor templates using Vue.js
- building testable/customizable authentication and authorization components
- Integration/unit test configuration
This isn’t an endorsement of the tools that we used to replace the defaults. Any tools can be used – including the defaults. My goal in writing this series is to share what we learned when moving away from defaults and how we built the pieces of what we consider a more robust “starter app”, one more conducive to modern developer workflow. We also happened to do a significant amount of work outside the typical toolchain and learned a bunch of lessons for that reason as well. If you’re using an alternative development platform and figuring out where to start when building an app using tools/frameworks other than the defaults, this series is for you.
How We Got Here
Visual Studio for Mac doesn’t have the same functionality as Visual Studio for Windows. I understand why, but it seems many tutorials involve code generation using options not available outside of Visual Studio for Windows. This includes Visual Studio for Mac, but also the dotnet command line tools. A great example is scaffolding authentication and authorization with overrides for custom views.
I wasn’t able to find much material on unit testing services and other code that relies on Identity and Entity Framework components. Specifically difficult was locating information on mocking. I was able to find tutorials for integration testing, but even then functionality I’m used to from other frameworks (migrations before test executions, configuration of set-up and tear-down through annotations, etc.) required a decent amount of configuration.
A scaffolded ASP.NET Core MVC app doesn’t include any tooling for relatively modern front-end development including managing front-end dependencies and assembly/minification of static assets.
Before we get started, like many other posts, I stood on the shoulders of many giants to build these examples. I’ll include links to their sites/posts and standard documentation wherever I can. Thanks to those folks for all their work. Code supporting these posts is located here: https://github.com/jrodenbostel/example-web-application.