fin*_*s10 5 c# filepath asp.net-core-3.1
我正在开发ASP.NET Core 3.1 Web API并有我的swagger设置。我已将 swagger 文档添加到我的项目中。
API Project-> Build->Output这将在我的项目根文件夹中生成xxx.xml文件。
右键-> xxx.xml-> Copy To Output Directory->Copy Always
我引用xxx.xmlswagger 配置中的文件Startup.cs如下
var xmlCommentsFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlCommentsFullPath = Path.Combine(AppContext.BaseDirectory, xmlCommentsFile);
options.IncludeXmlComments(xmlCommentsFullPath);
Run Code Online (Sandbox Code Playgroud)
这里我应该使用AppContext.BaseDirectoryor Assembly.GetEntryAssembly().Location?
在我的本地开发中运行它时,我可以看到它在里面bin\Debug\netcoreapp3.1\,但发布后文件夹结构将是相同的?。那么发布部署后会选择正确的路径吗?
| 归档时间: |
|
| 查看次数: |
7879 次 |
| 最近记录: |