I am trying to make a photoshop plug-in using C++/CLI and WPF interface. At this point I am just experimenting with loading wpf window from photoshop and doing some basic communication between managed and unmanaged code. I am using Visual Studio 2013, Photoshop CS6 nad Photoshop SDK CS5.
I added source file Source.cpp which contains my managed code. /clr for that file is enabled. I add a reference to an assembly via #using statement.
I referenced System.dll, Windows.dll, PresentationFramework.dll and WindowsBase.dll successfully. (There are some issues with intellisense which doesn't want to load metadata, but compiles without errors. I solved the intellisense issue by stating full name of the assemblies.) I can load Wpf window from Photoshop. It works.
However, I can not add a reference to my own non-framework assembly. It compiles without errors but - when I load plug-in in Photoshop with non-framework reference added and debug it, I get following error>
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Additional information: Could not load file or assembly 'ColorPickerControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2317994184a7a708' or one of its dependencies. The system cannot find the file specified.
I tried to change target framework of my dll, to make assembly shared (public) - hence PublicKeyToken is not null -, to return other assemblies name to their short name (I changed them because intellisense was not loading metadata). Didn't work.
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Controls;
using namespace System::Windows::Media;
//using namespace ColorPickerControlNamespace;
//PROBLEM - THIS IS WHERE EXCEPTION IS BEING THROWN
ColorPickerControlNamespace::ColorPickerControl^ c = gcnew ColorPickerControlNamespace::ColorPickerControl();
I've got it!!!!!! I AM THE HAPPIEST PERSON ON EARTH RIGHT NOW!!!!!!!!
Assembly HAS TO BE COPIED to Photoshop folder for some reason. Everything else stays the same!!!! Even full name reference like this
#using <C:\Users\Bogdan\Desktop\ColorPickerControl.dll>
I would like to ask if anybody knows why is this so, and why .net assemblies do not need to be in Photoshop folder?
I couldn't believe when it loaded. I couldn't. Really.
Oh how happy I am right now!