5
votes

I cannot find the namespace for ShellFile.

I have added using System.Windows.Shell and also tried loading the Windows7APICodePack through the package manager console:

PM> install-Package Windows7APICodePack

Installing 'Windows7APICodePack 1.0.0.0'.

You are downloading Windows7APICodePack from Microsoft, the license agreement to which is available at http://code.msdn.microsoft.com/WindowsAPICodePack/Project/License.aspx. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.

Successfully installed 'Windows7APICodePack 1.0.0.0'.

Adding 'Windows7APICodePack 1.0.0.0' to CADBuilderGUI.

Successfully added 'Windows7APICodePack 1.0.0.0' to CADBuilderGUI.

I just tried installing the later version 1.1.0.0 with:

PM> Install-Package Windows7APICodePack-Shell

but still no luck.

I am simply trying to get a thumbnail image of a file with:

ShellFile shellFile = ShellFile.FromFilePath(files[0]);
Bitmap shellThumb = shellFile.Thumbnail.ExtraLargeBitmap;

But it doesn't know what ShellFile is.

Any suggestions?


This is not a duplicate of this because PresentationFramework.dll is added by reference and I am building in Framework 4.0.

2
aside from adding using System.Windows.Shell; did you actually right click on the references node and add the reference manually as well..?MethodMan
yes, PresentationFramework.dll is an added referenceuser2368363
what ver of .net are you using 4.0 or 4.5 try to change from 4.5 to 4.0 then back to 4.5 and rebuild to see if the assembly gets picked in the .config fileMethodMan
Yea I tried that too before I asked, and still didn't change anythinguser2368363
what platform are you targetting?Daniel A. White

2 Answers

6
votes

PM> Install-Package WindowsAPICodePack-Core

PM> Install-Package WindowsAPICodePack-Shell

Install these two and it will work.

3
votes

It turns out that after downloading the latest packages as stated from above, you have to browse to the .dll package locations and add both by reference, then add the package namespaces:

using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack;