How delete files in ASP.Net 5

本文关键字:Net ASP in delete files How | 更新日期: 2023-09-27 18:26:29

我必须用程序从wwwroot'images中删除文件。ASP.Net 5 rc1中是否存在某种FileManager?

How delete files in ASP.Net 5

您可以通过将System.IO名称空间包含在平台依赖项中来使用它;

...
"frameworks": {
    "dnx451": { },
    "dnxcore50": {
        "dependencies": {
            "System.IO": "..." 
        }
    }
  },
...

并且使用File.Delete(pathToFile)