-1

I need to modernize some file I/O helper code from .NET 4.x to .NET 7, and in particular, a method to read Extended File Attributes. In the past, using Shell32 was regarded as a "necessary evil" to dive into file metadata.

Is there a more modern way to pull Extended File Attributes using .NET 7 and C#? For example, getting the "Date taken" information from a photo?

Thanks in advance for your help.

blcamp
  • 119
  • 15
  • You might get what you need by using this NuGet package: https://www.nuget.org/packages/MetadataExtractor – Peter B May 22 '23 at 23:58
  • @blcamp: I'm not too surprised. I expect the answer to be "no solution". Library recommends could provide a solution but those are off-topic, so somebody thinks it's a library recommendation question. – Joshua May 23 '23 at 00:06
  • @Joshua I'm definitely not asking for that - I'm looking to write 100% my own code to do this. – blcamp May 23 '23 at 19:50

1 Answers1

0

There is no modern API (at least out-of-the-box). There is a proposal to add such an API https://github.com/dotnet/runtime/issues/49604

Serg
  • 3,454
  • 2
  • 13
  • 17
  • Bummer. Not the answer I hoped for, but it did answer my question. So my next question is: can Shell32 still be used in .NET 7 in the meantime? – blcamp May 22 '23 at 23:59
  • 1
    @blcamp: Yes it can, if you can live with only on Windows. That's the point of the modern .NET is you can move off Windows at will if you use only its APIs. – Joshua May 23 '23 at 00:07
  • 1
    Sure, you still can use the old approach via COM or P/Invoke. The latter one may have become even simpler thanks to CSWin32 P/Invoke source generators. All this is windows-only, of course. – Serg May 23 '23 at 00:07