Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Hi everybody!

This is my last chance to find a solution...

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.

Any suggestions?

My code (in Source.cpp):


#using <System.dll>
#using <PresentationCore.dll>
#using <PresentationFramework.dll>
#using <WindowsBase.dll>



#using <C:\Users\Bogdan\Desktop\ColorPickerControl.dll> //PROBLEM


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);

//PROBLEM - THIS IS WHERE EXCEPTION IS BEING THROWN
ColorPickerControlNamespace::ColorPickerControl^ c = gcnew ColorPickerControlNamespace::ColorPickerControl();


w->Content = g;
w->ShowDialog();

Byte bb = Convert::ToByte(txt->Text);
return bb;
}

PLEASE HELP
Posted

1 solution

Most probably, your assembly links to some DLL which cannot be found in the search path. If the C++/CLI code contains "additional dependencies", the corresponding DLLs must be copied to the output path of your unit test project which references the assembly with the C++/CLI code.

Look into the project properties of your C++/CLI project which is referenced by your unit test project. Go to the "Linker/Input" properties. If there are LIB files listed under "Additional dependencies", make sure the according DLLs are present in the output path of your unit test project.

Unfortunately, the fusion assembly binder protocol still reports the assembly to be loaded successfully if C++ libraries referenced from there cannot be loaded.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900