ShellFile Error: missing assembly reference?
Asked Answered
W

2

5

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.

Wherefore answered 9/6, 2014 at 21:53 Comment(6)
aside from adding using System.Windows.Shell; did you actually right click on the references node and add the reference manually as well..?Snappish
yes, PresentationFramework.dll is an added referenceWherefore
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 fileSnappish
Yea I tried that too before I asked, and still didn't change anythingWherefore
what platform are you targetting?Construct
Readers - This worked for me perfectly. Installed NUGET packages WindowsAPICodePack-Core and WindowsAPICodePack-Shell. Added project reference to System.Drawing. Added additional line of code: shellThumb.Save(path, format). The output image was 256x256 16kb.Kishke
S
6

PM> Install-Package WindowsAPICodePack-Core

PM> Install-Package WindowsAPICodePack-Shell

Install these two and it will work.

Sennacherib answered 10/2, 2016 at 8:40 Comment(0)
W
3

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;
Wherefore answered 10/6, 2014 at 0:50 Comment(1)
makes me wonder why adding this one would not do the trick using Microsoft.WindowsAPICodePack.Shell; in regards to dot dereferenceSnappish

© 2022 - 2024 — McMap. All rights reserved.