user2368363
user2368363

Reputation: 309

ShellFile Error: missing assembly reference?

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.

Upvotes: 5

Views: 7013

Answers (2)

cpmars
cpmars

Reputation: 61

PM> Install-Package WindowsAPICodePack-Core

PM> Install-Package WindowsAPICodePack-Shell

Install these two and it will work.

Upvotes: 6

user2368363
user2368363

Reputation: 309

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;

Upvotes: 3

Related Questions