views:

817

answers:

2

Hello!

I'm having a little problem with Photoshop CS4 automation. When I want to add a reference to the COM API in my Visual Studio 2008 project, the Adobe Photoshop Object Library doesn't show up in the "Add References" panel under the "COM" tab. However, the Illustrator CS4 Type library show up just fine. Photoshop itself run perfectly, both in the 32 and 64 bit flavor. Photoshop was installed along with every other app of the Master Suite CS4.

This didn't work on both Windows 7 and Windows XP, on 2 different machine + 1 virtual PC (Vmware workstation). I also tried it in the VS2010 Beta 1 and the MS Word VB editor, but it didn't work here either.

Anybody has any thought? If you were able to add a reference, what was your configuration?

+1  A: 

In the end, the solution was to use a Windows XP Virtual Machine with a standalone installation of Photoshop (instead of the whole creative suite). You can use it to generate a dll that work on any Windows with any installation of Photoshop CS4 (standalone or the creative suite).

EDIT : Here is the whole process

Create a Windows XP virtual Machine with your favorite virtualisation solution (Vmware, VirtualBox, VirtualPC etc). Install Visual Studio 2008 and a standalone installation of Photoshop CS4 (The whole creative suits haven't worked in my case, but your mileage may vary). Open Visual Studio and create either a new VB.NET or C# class library. Once this is done, right click on the "reference" folder in the solution explorer, and select add reference. Go to the COM tab, and search for "Adobe Photoshop CS4 type library". This will add two new references : "Photoshop" and "PhotoshopTypeLibrary". Create a dummy function (altough it may not be required) and build your project. As a good mesure, you can make sure that the compile mode is set to "release" but this is not required, debug will work fine. Once your project is builded, go to your project folder on your VM hard drive and look for the bin\release folder. There you will see 3 dll : one named after your project, one named Photoshop.dll and another namde Interop.Photoshop.dll. Copy the two last on your developpement machine with Windows 7 x64. You can then import them in your project by adding a references and browsing to those 2 dll.

A very sweet thing I noticed was that altough the dll were compiled on a 32 bit VM, they would still call the 64 bit version of Photoshop if your .NET program runned in 64 bit mode.

I hope it help!

Laurent Bourgault-Roy
A: 

Kalem13, can you please post more details about the solution for this problem?

How do I go about generating the dll on the XP machine?

I am having the same problem you described in Win7 x64.

Martin Aatmaa
Your request as been answered good sir ^^. If you need more details, I can provide them.
Laurent Bourgault-Roy
Hi Kalem13, that is awesome. Thank you so much for your help.I'll give it a try and let you know if I have any issues. Best regards, Martin
Martin Aatmaa