Visual Studio不断将IIS Express重新添加到我的launchsettings.json中 [英] Visual Studio keeps adding IIS Express back into my launchsettings.json
问题描述
我试图从.NET Core启动设置中删除IIS Express配置文件,但是每次我提出该解决方案时,Visual Studio都将其重新添加回去。例如,在一个新项目中,我的启动设置如下:
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"
}
}
}
}
我删除了IIS部分
{
"profiles": {
"MyProject": {
"commandName": "Project",
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
该解决方案运行良好。但是,一旦我关闭并重新打开解决方案,IIS部分就会重新出现。
The solution runs fine. But as soon as I close and reopen the solution the IIS sections reappear.
有什么想法吗?
推荐答案
更新:
该问题应通过Visual Studio 2017(版本)的最新版本(更新)解决。 15.3.0)。
The issue should be fixed with the latest release (update) of Visual Studio 2017 (version 15.3.0).
初始答案:
这不是解决方案,但这是一个丑陋的解决方法。我认为,如果我只是拒绝更改 launchsettings.json
文件的权限,这将防止Visual Studio每次覆盖它。由于此文件变化不大,因此对我来说还是一个令人满意的解决方案。
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.
所以:
- 最后一次更新您的
launchsettings.json
。 - 关闭Visual Studio。
- 打开安全设置(在资源管理器->属性->安全性中右键单击launchsettings.json)
- 单击高级->更改权限
- 从权限条目列表中选择授权用户(或在您的计算机上运行Visual Studio的其他用户组),然后单击编辑->
- 检查拒绝创建文件/写入数据权限。
- 在所有打开的对话框和警告中单击确定以保存更改。
- 重新打开Visual Studio并查看
- 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.
希望它会有所帮助。
这篇关于Visual Studio不断将IIS Express重新添加到我的launchsettings.json中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!