首页 > 解决方案 > 从当前项目文件夹加载文件

问题描述

我正在尝试加载 json 文件,同时在测试项目中模拟 api 以进行测试。模拟将加载 json。

在此处输入图像描述

我目前正在使用File.ReadAllText,我尝试了以下

System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory.ToString(), "bank_response.json")

System.IO.Path.GetFullPath(Directory.GetCurrentDirectory() + @"\bank_response.json"); 我得到了 bin 或 null 的路径。

标签: c#asp.net-core

解决方案


推荐阅读