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?
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:
- Update your
launchsettings.json
for the last time. - Close Visual Studio.
- Open security settings (right-click on launchsettings.json in Explorer -> Properties -> Security)
- Click Advanced -> Change Permissions
- Select "Authenticated Users" (or other user group under which Visual Studio is running on your machine) from the "Permissions entries" list and click Edit ->
- Check Deny for "Create files / write data" permission.
- Click OK in all open dialogs and warnings to save changes.
- Reopen Visual Studio and see it fail to do it's update.
Hope it helps.
来源:https://stackoverflow.com/questions/43098113/visual-studio-keeps-adding-iis-express-back-into-my-launchsettings-json