在ASP.NET Core 2.2项目上,我需要获取:
我能够获取文件内容,但是文件名始终为空:
Assembly assembly = Assembly.GetAssembly(this.GetType());
foreach (String name in assembly.GetManifestResourceNames()) {
Stream stream = assembly.GetManifestResourceStream(name);
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) {
String content = reader.ReadToEnd();
var filename = assembly.GetManifestResourceInfo(name).FileName;
}
}
以下行不应该给我文件名吗?
var filename = assembly.GetManifestResourceInfo(name).FileName;