CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2015
    Posts
    2

    C++/CLI assembly loading FileNotFoundException

    Hi everybody!

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

    My problem is very similar to problem presented in this thread:
    http://forums.codeguru.com/showthrea...4648-C-modules

    However, I do not understand how guy resolved the problem. So what is it about:

    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

  2. #2
    Join Date
    Apr 2015
    Posts
    2

    Re: C++/CLI assembly loading FileNotFoundException

    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured