0

I am in the process of writing a .NET wrapper for legacy native c++ code. My strategy is to write a CLR class library that wraps the native code.

To test whether the class library is functioning properly, I created two console apps in separate solutions:

  1. A C++ CLR console app
  2. A C# console app

Both of these contain the same simple test code to exercise the class library.

Both apps build as expected. The C++ app runs just fine, but the C# app is giving me a FileNotFoundException when it tries to load my class library.

I have a constraint that forces me to use VS2008 and .NET 3.5. Everything is built with Win32 or x86 configurations.

For both console apps, I am using a project reference to the class library.

In each case, builds copy the dll (and the intermediate files) to the same directory where each app is built.

I tried using the fusion log viewer, but logs are disabled on my machine and I do not have administrator privileges.

Has anyone ever seen this before?

Can someone please point me to a good site that outlines the differences between the way C# and C++ CLR apps load assemblies?

Since this is my first attempt to bridge C++ and C# I assume I am just making a simple mistake somewhere, but I am stumped as to what that is.

I have trolled the internet (including many SO postings) but have yet to find exactly what I need.

Thanks in advance, Judd

  • Do you have the native libraries used by your wrapper in the path? Failing that, did you copy them to the execution folder of both the C# and C++ test apps? (There are ways to hook native libraries into a class library, but things get notoriously finicky) PS - what is the native library? C DLL? C++ DLL? COM library? Also, execution path moves around for C# depending on if you're debugging or running from command line. –  Jul 22 '13 at 18:12
  • Thanks for your response! It was the path. In the C++ version, I had all the native library paths specified. In the C# one, I did not. (See, I knew it had to be something simple). I do not see a good way to specify the path when debugging the C# app. Any suggestions? Thanks again. Judd – Judd Weeks Jul 22 '13 at 18:50
  • Very hard to help programmers that are not allowed to use the tools you need to get the job done. I can only recommend [this site](http://careers.stackoverflow.com/). Try SysInternals' ProcMon. – Hans Passant Jul 22 '13 at 21:13

0 Answers0