12

I am trying to remove the IIS Express profile from my .NET Core launch settings but every time i repoen the solution, Visual Studio adds it back in again. For example, in a new project my launch settings looks like this

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:55735/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "MyProject": {
      "commandName": "Project",
      "launchUrl": "http://localhost:5010",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

I remove the IIS sections

{
  "profiles": {
    "MyProject": {
      "commandName": "Project",
      "launchUrl": "http://localhost:5010",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

The solution runs fine. But as soon as I close and reopen the solution the IIS sections reappear.

Any ideas?

Kevin Brydon
  • 12,524
  • 8
  • 46
  • 76
  • This is really annoying, but I guess this is just how it is for now. According to [this discussion](https://github.com/aspnet/Tooling/issues/486) there is some ticket created almost a year ago, but no comments on whether this will be ever fixed/changed. – Ilya Luzyanin Mar 30 '17 at 14:44

3 Answers3

7

UPDATE:

The issue should be fixed with the latest release (update) of Visual Studio 2017 (version 15.3.0).

Initial answer:

This is not a solution, but an ugly workaround. I figured that if I would just deny permissions to change the launchsettings.json file this will prevent Visual Studio from overwriting it every time. Since this file doesn't change much, it is more or less a satisfying solution for me.

So:

  1. Update your launchsettings.json for the last time.
  2. Close Visual Studio.
  3. Open security settings (right-click on launchsettings.json in Explorer -> Properties -> Security)
  4. Click Advanced -> Change Permissions
  5. Select "Authenticated Users" (or other user group under which Visual Studio is running on your machine) from the "Permissions entries" list and click Edit ->
  6. Check Deny for "Create files / write data" permission.
  7. Click OK in all open dialogs and warnings to save changes.
  8. Reopen Visual Studio and see it fail to do it's update.

Hope it helps.

Kevin Brydon
  • 12,524
  • 8
  • 46
  • 76
Ilya Luzyanin
  • 7,910
  • 4
  • 29
  • 49
0

In my case the issue was related to a missing bracket at the end of the file, so Visual Studio was being unable to process it, please check the JSON format is correct.

Dayán Ruiz
  • 611
  • 1
  • 9
  • 22
-1

just check your launch settings file is a valid for JSON format, you should forget a comma or mustache