How does the web server know what to send to the browser when a specific URL is requested? The answer lies in the configuration of your Web API project.
In this section, we will learn how to set up your dependencies automatically using the IDE, or manually by editing your project's configuration file:
To pull in the necessary dependencies, you may right-click on the using statement for
Microsoft.AspNet.Mvc
and select Quick Actions and Refactorings.... This can also be triggered by pressing Ctrl + . (period) on your keyboard or simply by hovering over the underlined term, as shown in the following screenshot:Visual Studio should offer you several possible options, from which you can select the one that adds the package
Microsoft.AspNetCore.Mvc.Core
for the namespaceMicrosoft.AspNetCore.Mvc
. For theController
class, add a reference for theMicrosoft.AspNetCore.Mvc.ViewFeatures
package, as shown in the following screenshot...