简体   繁体   中英

Visual Studio 2017 .net core 2.0 console

Hi I'm new in the visual studio 2017 and .net core 2.0 world. I have started to working on a project of a colleague that in the moment is not at work. It start correctly. Only one thing disturb me a lot:

When I start the application with Visual Studio 2017 then a console (not in VS) appear in the window and a browser opens. When I close the console or the browser the application die. The application has only back end function, so I don't need the browser. Is there some way to:

  • tell VS to run the console in an internal window of VS?
  • tell VS to not show the browser?

Thank you in advance

PS: I think this is a more VS setting so I didn't wrote the code. But If you think there are more info that can help you to figure out my problem, don't hesitate to ask me. Thanks

在此处输入图片说明

In a asp.net core application there is a folder called properties, in that folder there is a file called launchSettings.json.

Open up the file and you will find json like this:

     {
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
  "applicationUrl": "http://localhost:55556/",
  "sslPort": 0
 }
},
"profiles": {
"IIS Express": {
  "commandName": "IISExpress",
  "launchBrowser": true,
  "launchUrl": "api/getallobjects",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},
"MyServer": {
  "commandName": "Project",
  "launchBrowser": true,
  "launchUrl": "api/getallobjects",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  },
  "applicationUrl": "http://localhost:5000/"
}
}
}

You can edit this json to adjust what visual studio does when it launches.

So in your case if you want to stop the browser from starting just change the launchBrowser property to false .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM