Hi, ASP.NET MVC will not work on Mac but ASP.NET Core is meant to work. You should be able to develop an ASP.NET Core Web API on a Mac using Visual Studio for Mac Community edition. I'm not sure if you have seen these links already but here is the Visual Studio 2017 for Mac Platform Targeting and Compatibility. And here is the how to develop and the next steps. Since I am planning to buy a new MacBook Pro (2017) and currently working on a Windows 10-device on a ASP.NET MVC (Not ASP.NET Core MVC) project for my internship, I was wondering if it is possible to continue developing the same project in Visual Studio for Mac. Developer Community for Visual Studio Product family. A just find a small problem is Visual Studio 2017. It not too important but I think Visual Studio 2017 will perfect than if it is fixed.
- Visual Studio For Mac Asp.net Mvc Interview
- Visual Studio For Mac Tutorial
- Microsoft Visual Studio For Mac
- Asp.net Mvc On Visual Studio For Mac
By Daniel Roth, Steve Smith, Rick Anderson and Shayne Boyer
This article will show you how to write your first ASP.NET Core application on a Mac.
Sections:
Visula studio for mac. To setup your development machine download and install .NET Core and Visual Studio Code with the C# extension. Node.js and npm is also required. If not already installed visit nodejs.org.
We will be using
yoaspnet
to generate the Web Application Basic template, you may follow the full instructions in Building Projects with Yeoman to create an ASP.NET Core project which show an Empty Web for reference.
Install the necessary yeoman generators and bower using npm.
Run the ASP.NET Core generator
- Select Web Application Basic [without Membership and Authorization] and tap Enter
- Select Bootstrap (3.3.6) as the UI framework and tap Enter
- Use “MyFirstApp” for the app name and tap Enter
When the generator completes scaffolding the files, it will instruct you to restore, build, and run the application.
- Start Visual Studio Code
- Tap File > Open and navigate to your ASP.NET Core app
When the application is opened, Visual Studio Code will prompt to restore the needed project dependencies as well as add build and debug dependencies.
Tap “Yes” to add the build and debug assets.
Tap “Restore” to restore the project dependencies. Alternately, you can enter
⌘⇧P
in Visual Studio Code and then type dot
as shown:
You can run commands directly from within Visual Studio Code, including
dotnetrestore
and any tools referenced in the project.json file, as well as custom tasks defined in .vscode/tasks.json. Visual Studio Code also includes an integrated console ⌃`
where you can execute these commands without leaving the editor.
If this is your first time using Visual Studio Code (or just Code for short), note that it provides a very streamlined, fast, clean interface for quickly working with files, while still providing tooling to make writing code extremely productive.
In the left navigation bar, there are five icons, representing four viewlets:
- Explore
- Search
- Git
- Debug
- Extensions
The Explorer viewlet allows you to quickly navigate within the folder system, as well as easily see the files you are currently working with. It displays a badge to indicate whether any files have unsaved changes, and new folders and files can easily be created (without having to open a separate dialog window). You can easily Save All from a menu option that appears on mouse over, as well.
The Search viewlet allows you to quickly search within the folder structure, searching filenames as well as contents.
Code will integrate with Git if it is installed on your system. You can easily initialize a new repository, make commits, and push changes from the Git viewlet.
The Debug viewlet supports interactive debugging of applications.
Code’s editor has a ton of great features. You’ll notice unused using statements are underlined and can be removed automatically by using
⌘.
when the lightbulb icon appears. Classes and methods also display how many references there are in the project to them. If you’re coming from Visual Studio, Code includes many of the same keyboard shortcuts, such as ⌘KC
to comment a block of code, and ⌘KU
to uncomment.
More on editor in Visual Studio Code.
The sample is configured to use Kestrel for the web server. You can see it configured in the project.json file, where it is specified as a dependency.
Using Visual Studio Code Debugger¶
If you chose to have the debug and build assets added to the project:
- Tap the Debug icon in the View Bar on the left pane
- Tap the “Play (F5)” icon to launch the app
Your default browser will automatically launch and navigate to
http://localhost:5000
- To stop the application, close the browser and hit the “Stop” icon on the debug bar
Using the dotnet commands¶
- Run
dotnetrun
command to launch the app from terminal/bash - Navigate to
http://localhost:5000
- To stop the web server enter
⌃+C
.
Once you’ve developed your application, you can easily use the Git integration built into Visual Studio Code to push updates to production, hosted on Microsoft Azure.
Initialize Git¶
Initialize Git in the folder you’re working in. Tap on the Git viewlet and click the
InitializeGitrepository
button.
Add a commit message and tap enter or tap the checkmark icon to commit the staged files.
Git is tracking changes, so if you make an update to a file, the Git viewlet will display the files that have changed since your last commit.
Initialize Azure Website¶
You can deploy to Azure Web Apps directly using Git.
- If you don’t have an Azure account, you can create a free trial.
Create a Web App in the Azure Portal to host your new application.
Configure the Web App in Azure to support continuous deployment using Git.
Record the Git URL for the Web App from the Azure portal.
In a Terminal window, add a remote named
azure
with the Git URL you noted previously.
gitremoteaddazurehttps://[email protected]:443/MyFirstAppMac.git
Push to master.
gitpushazuremaster
to deploy.
Browse to the newly deployed web app.
Looking at the Deployment Details in the Azure Portal, you can see the logs and steps each time there is a commit to the branch.
-->
By Rick Anderson
This tutorial teaches ASP.NET Core MVC web development with controllers and views. If you're new to ASP.NET Core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point.
Visual Studio For Mac Asp.net Mvc Interview
This tutorial teaches the basics of building an ASP.NET Core MVC web app.
The app manages a database of movie titles. You learn how to:
- Create a web app.
- Add and scaffold a model.
- Work with a database.
- Add search and validation.
At the end, you have an app that can manage and display movie data.
View or download sample code (how to download).
Prerequisites
- Visual Studio 2019 with the ASP.NET and web development workload
The Visual Studio Code instructions use the .NET Core CLI for ASP.NET Core development functions such as project creation. You can follow these instructions on any platform (macOS, Linux, or Windows) and with any code editor. Minor changes may be required if you use something other than Visual Studio Code.
Create a web app
-
From the Visual Studio select Create a new project.
-
Select ASP.NET Core Web Application and then select Next.
-
Name the project MvcMovie and select Create. It's important to name the project MvcMovie so when you copy code, the namespace will match.
-
Select Web Application(Model-View-Controller), and then select Create.
Visual Studio used the default template for the MVC project you just created. You have a working app right now by entering a project name and selecting a few options. This is a basic starter project.
The tutorial assumes familarity with VS Code. See Getting started with VS Code and Visual Studio Code help for more information.
-
Open the integrated terminal.
-
Change directories (
cd
) to a folder which will contain the project. -
Run the following command:
-
A dialog box appears with Required assets to build and debug are missing from 'MvcMovie'. Add them? Select Yes
-
dotnet new mvc -o MvcMovie
: creates a new ASP.NET Core MVC project in the MvcMovie folder. -
code -r MvcMovie
: Loads the MvcMovie.csproj project file in Visual Studio Code.
-
-
Select File > New Solution.
-
Select .NET Core > App > Web Application (Model-View-Controller) > Next.
-
In the Configure your new ASP.NET Core Web API dialog, set the Target Framework of .NET Core 3.0.
- Name the project MvcMovie, and then select Create.
Run the app
Select Ctrl-F5 to run the app in non-debug mode.
Visual Studio displays the following dialog:
Select Yes if you trust the IIS Express SSL certificate.
The following dialog is displayed:
Select Yes if you agree to trust the development certificate.
See Trust the ASP.NET Core HTTPS development certificate for more information.
-
Visual Studio starts IIS Express and runs the app. Notice that the address bar shows
localhost:port#
and not something likeexample.com
. That's becauselocalhost
is the standard hostname for your local computer. When Visual Studio creates a web project, a random port is used for the web server. -
Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file, refresh the browser, and see the code changes. Many developers prefer to use non-debug mode to quickly launch the app and view changes.
-
You can launch the app in debug or non-debug mode from the Debug menu item:
-
You can debug the app by selecting the IIS Express buttonThe following image shows the app:
Press Ctrl+F5 to run without the debugger.
-
Trust the HTTPS development certificate by running the following command:The preceding command doesn't work on Linux. See your Linux distribution's documentation for trusting a certificate.The preceding command displays the following dialog:
-
Select Yes if you agree to trust the development certificate.See Trust the ASP.NET Core HTTPS development certificate for more information.
Visual Studio Code starts Kestrel, launches a browser, and navigates to
https://localhost:5001
. The address bar shows localhost:port:5001
and not something like example.com
. That's because localhost
is the standard hostname for local computer. Localhost only serves web requests from the local computer.
Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file, refresh the browser, and see the code changes. Many developers prefer to use non-debug mode to refresh the page and view changes.
Select Run > Start Without Debugging to launch the app. Visual Studio for Mac starts Kestrel server, launches a browser, and navigates to
http://localhost:port
, where port is a randomly chosen port number.
-
Trust the HTTPS development certificate by running the following command:
-
The preceding command displays the following output:
-
Enter the admin username and password if prompted. The certificate will now be installed and trusted.See Trust the ASP.NET Core HTTPS development certificate for more information.
-
The address bar shows
localhost:port#
and not something likeexample.com
. That's becauselocalhost
is the standard hostname for your local computer. When Visual Studio creates a web project, a random port is used for the web server. When you run the app, you'll see a different port number. -
You can launch the app in debug or non-debug mode from the Run menu.The following image shows the app:
Visual Studio help
Visual Studio Code help
Visual Studio for Mac help
In the next part of this tutorial, you learn about MVC and start writing some code.
This tutorial teaches ASP.NET Core MVC web development with controllers and views. If you're new to ASP.NET Core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point.
This tutorial teaches the basics of building an ASP.NET Core MVC web app.
The app manages a database of movie titles. You learn how to:
- Create a web app.
- Add and scaffold a model.
- Work with a database.
- Add search and validation.
At the end, you have an app that can manage and display movie data.
View or download sample code (how to download).
Prerequisites
- Visual Studio 2019 with the ASP.NET and web development workload
Warning
If you use Visual Studio 2017, see dotnet/sdk issue #3124 for information about .NET Core SDK versions that don't work with Visual Studio.
The Visual Studio Code instructions use the .NET Core CLI for ASP.NET Core development functions such as project creation. You can follow these instructions on any platform (macOS, Linux, or Windows) and with any code editor. Minor changes may be required if you use something other than Visual Studio Code. Sql server express management studio 2014 download for mac.
Create a web app
-
From the Visual Studio select Create a new project. Download invision studio.
-
Selecct ASP.NET Core Web Application and then select Next.
-
Name the project MvcMovie and select Create. It's important to name the project MvcMovie so when you copy code, the namespace will match.
-
Select Web Application(Model-View-Controller), and then select Create.
Visual Studio used the default template for the MVC project you just created. You have a working app right now by entering a project name and selecting a few options. This is a basic starter project, and it's a good place to start.
Visual Studio For Mac Tutorial
The tutorial assumes familarity with VS Code. See Getting started with VS Code and Visual Studio Code help for more information.
-
Open the integrated terminal.
-
Change directories (
cd
) to a folder which will contain the project. -
Run the following command:
-
A dialog box appears with Required assets to build and debug are missing from 'MvcMovie'. Add them? Select Yes
-
dotnet new mvc -o MvcMovie
: creates a new ASP.NET Core MVC project in the MvcMovie folder. -
code -r MvcMovie
: Loads the MvcMovie.csproj project file in Visual Studio Code.
-
-
Select File > New Solution.
-
Select .NET Core > App > Web Application (Model-View-Controller) > Next.
-
In the Configure your new ASP.NET Core Web API dialog, accept the default Target Framework of .NET Core 2.2.
-
Name the project MvcMovie, and then select Create.
Run the app
Select Ctrl-F5 to run the app in non-debug mode.
Visual Studio displays the following dialog:
Select Yes if you trust the IIS Express SSL certificate.
The following dialog is displayed:
Select Yes if you agree to trust the development certificate.
See Trust the ASP.NET Core HTTPS development certificate for more information.
-
Visual Studio starts IIS Express and runs the app. Notice that the address bar shows
localhost:port#
and not something likeexample.com
. That's becauselocalhost
is the standard hostname for your local computer. When Visual Studio creates a web project, a random port is used for the web server. -
Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file, refresh the browser, and see the code changes. Many developers prefer to use non-debug mode to quickly launch the app and view changes.
-
You can launch the app in debug or non-debug mode from the Debug menu item:
-
You can debug the app by selecting the IIS Express button
-
Select Accept to consent to tracking. This app doesn't track personal information. The template generated code includes assets to help meet General Data Protection Regulation (GDPR).The following image shows the app after accepting tracking:
Press Ctrl+F5 to run without the debugger.
Microsoft Visual Studio For Mac
-
Trust the HTTPS development certificate by running the following command:The preceding command doesn't work on Linux. See your Linux distribution's documentation for trusting a certificate.The preceding command displays the following dialog:
-
Select Yes if you agree to trust the development certificate.See Trust the ASP.NET Core HTTPS development certificate for more information.
Visual Studio Code starts Kestrel, launches a browser, and navigates to
https://localhost:5001
. The address bar shows localhost:port:5001
and not something like example.com
. That's because localhost
is the standard hostname for local computer. Localhost only serves web requests from the local computer.
Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file, refresh the browser, and see the code changes. Many developers prefer to use non-debug mode to refresh the page and view changes.
-
Select Accept to consent to tracking. This app doesn't track personal information. The template generated code includes assets to help meet General Data Protection Regulation (GDPR).The following image shows the app after accepting tracking:
Select Run > Start Without Debugging to launch the app. Visual Studio for Mac starts Kestrel server, launches a browser, and navigates to
http://localhost:port
, where port is a randomly chosen port number.
-
Trust the HTTPS development certificate by running the following command:
-
The preceding command displays the following output:
-
Enter the admin username and password if prompted. The certificate will now be installed and trusted.See Trust the ASP.NET Core HTTPS development certificate for more information.
-
The address bar shows
localhost:port#
and not something likeexample.com
. That's becauselocalhost
is the standard hostname for your local computer. When Visual Studio creates a web project, a random port is used for the web server. When you run the app, you'll see a different port number. -
You can launch the app in debug or non-debug mode from the Run menu.
-
Select Accept to consent to tracking. This app doesn't track personal information. The template generated code includes assets to help meet General Data Protection Regulation (GDPR).The following image shows the app after accepting tracking:
Visual Studio help
Visual Studio Code help
Asp.net Mvc On Visual Studio For Mac
Visual Studio for Mac help
In the next part of this tutorial, you learn about MVC and start writing some code.