I am making a photoshop plug-in using C++/CLI. Some files in the project are compiled to native code, and one file is compiled to managed code. Because of that, I cannot add a reference to an assembly on project level, but rather on file level 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 assembly.)
However, I can not add a reference to my own non-framework assembly. When I load plug-in in Photoshop 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.
Any suggestions? It might be a problem with target framework, but I don't know what should be stated as a target framework. It's C++/CLI - no properties dialog like in C# where you can easily select target framework.
My code:
#using <System.dll>
#using <PresentationCore.dll>
#using <PresentationFramework.dll>
#using <WindowsBase.dll>
#using <C:\Users\Bogdan\Desktop\ColorPickerControl.dll>
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Controls;
using namespace System::Windows::Media;
//using namespace ColorPickerControlNamespace;
char __cdecl fManaged2(const char* input)
{
Window^ w = gcnew Window();
Label^ l = gcnew Label();
l->Content = "This works!";
l->Background = Brushes::Orange;
TextBox^ txt = gcnew TextBox();
txt->Width = 300;
txt->Height = 25;
Grid^ g = gcnew Grid();
g->Children->Add(l);
g->Children->Add(txt);
ColorPickerControlNamespace::ColorPickerControl^ c = gcnew ColorPickerControlNamespace::ColorPickerControl();
w->Content = g;
w->ShowDialog();
Byte bb = Convert::ToByte(txt->Text);
return bb;
}