//获取应用程序所在目录的2种方式(绝对,不受工作目录影响,建议采用此方法获取路径).如:d:\Users\xk\Desktop\WebApplication1\WebApplication1\bin\Debug\netcoreapp2.0\
            String basePath1 = AppContext.BaseDirectory;
            String basePath2 =Path.GetDirectoryName(typeof(Program).Assembly.Location);
            //注意:对于 Linux 或非 Windows 操作系统,文件名和路径区分大小写。 例如,“SwaggerDemo.xml”文件在 Windows 上有效,但在 CentOS 上无效。
            String path =Path.Combine(basePath2, "SwaggerDemo.xml");

 

相关文章:

  • 2021-07-25
  • 2022-12-23
  • 2021-11-02
  • 2021-09-28
  • 2021-12-23
  • 2021-06-15
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-13
  • 2021-04-05
相关资源
相似解决方案