ASP.NET Core MVC on Apple Silicon: A Dev Setup Guide
Setting Up ASP .NET Core MVC Environment on a Mac with Apple Silicon (M1, M2, M3…)
If you’re like me, committed to using macOS exclusively, you’ve likely encountered the challenge of setting up an ASP .NET Core environment on a Mac with the Apple chip. With Visual Studio unavailable for these devices, I’ve compiled a guide on how to build an ASP .NET environment using Visual Studio code and .Net Core SDK.
Once you have your SDK and VScode installed then add these extensions:
- C#: This would provide language support for the C# language
- C# Dev Kit: This works in hand with the C# extension it would help with unit testing
- .NET Install Tool:
- .NET Core Test Explorer
- .NET MAUI
- EditorConfig for VS Code
- Code Runner
- ESLint (if using JavaScript/TypeScript)
Create MVC Project
After installing the above extensions, proceed to create a new project. Open the folder containing your ASP .NET Core project, then open a terminal tab in the folder. Run dotnet new mvc
in the terminal. Follow the prompts to select options and name your project. Enjoy building your project!
Run MVC Project
To run your project, execute dotnet restore
in your terminal to ensure all packages are installed correctly. Then, use dotnet run
to preview your build on localhost. You can debug your code using the fnF5 key.
Alternative For Server Explorer
While VS Code lacks a built-in server explorer like Visual Studio, we can configure SQL Server as the default storage for the MVC application. Edit the connection string in the application’s configuration located in the appsettings.json
file within the properties folder. Install the Entity Framework Core package using the dotnet add package
command. Configure your DbContext file and test the connection.
Conclusion
I’m available for any questions or clarifications you may have. Please feel free to criticize and suggest corrections. Sharing is appreciated. Thank you.