我在 Visual Studio Community 2022 中创建了一个新项目,但 launchSettings.json 中不存在该项目。
它曾经默认这样做。但是,我一定是按了键盘上的某个键,或者通过肌肉抽搐或退缩或其他原因无意中单击了某些键,因为它不再创建默认值。
我需要更改什么设置才能使其正常工作?
步骤:
打开 Visual Studio
“创建新项目”
空白解决方案 - 输入名称
右键单击解决方案>添加
新项目
输入项目名称 BookStoreApp.API
点击创建
并且...个人资料中没有任何内容...
我希望该项目能够在 IIS Express、https 和 http 的配置文件中显示。
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5109"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7290;http://localhost:5109"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50107",
"sslPort": 44322
}
}
}
仅就上下文而言,我执行了以下操作: 系统重新启动 重新安装 Visual Studio Windows 系统还原 > 毫不留情 > 所有文件已擦除 问题仍然存在。对我来说很奇怪它会停止。我想我可以将 http 配置文件重命名为我的项目,但默认情况下该项目仍应添加到 launchSettings.json 文件中。 –
您是否正在尝试创建空白解决方案,以便不会自动创建文件?您需要通过创建的解决方案上的“添加”选项来创建所需的文件。
您应该选择合适的项目模板 例如 ASP.NET Core WEB API、ASP.NET Core Web 应用程序、ASP.NET Web 应用程序。
请对 ASP.NET 模板执行相同的步骤。