运行 .NET Core 应用程序通过 VS2015 中的控制台

Run .NET Core App via Console in VS2015

在 Visual Studio 2015 Community Edition 中,我通过控制台 运行 我的 .NET Core Web API 应用程序,方法是从工具栏上的 运行ning 配置文件选项中选择 [AppName] (靠近小绿色三角形,下拉菜单)在我之前的项目中。默认选项是 IIS Express 和 [AppName],其中 运行s dotnet restore 和命令提示符下的 dotnet 运行。

在我重新安装 Windows 10 和 VS2015 之后,当我创建一个新项目时,我无法再在下拉列表中看到默认的 [AppName] 选项。它只有一个选项,即IISExpress。

如何重新启用它?我还为 VS2015 安装了点网核心工具。

谢谢。

我找到了解决方案。

在解决方案资源管理器 > YourProject > 属性 > launchSettings.json 中, 您应该将其添加到 profiles:

"YourProjectName": {
  "commandName": "Project",
  "launchBrowser": true,
  "launchUrl": "http://localhost:5000",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }

然后您可以更改启动选项: