Calling Shell32.dll from .NET Windows Service
问题 I have a .NET 4.0 library that uses Shell32 and Folder.GetDetailsOf() to get metadata from WTV files. I have used it successfully with Console and Windows Forms apps without issue. But for some reason, when calling the component from a .NET 4.0 Windows Service, the call to initiate the Shell class causes a COM error. The code that fails inside the library: Shell32.Shell shell = new Shell(); The error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Shell32.Shell'.