OpenNETCF dll embedded in image

A

A.User

I have a custom CE.NET device that I have built the OpenNETCF.dll into.
I have some CF/OpennetCF app that I also built into the image. These are all
place in the \windows directory and are hard coded right into the image.
They all work fine.
I am now building more CF/OpenNETCF apps that I am debugging and deploying
to my storage card.
I noticed another copy of the OpenNetcf.dll is also copied to the storage
card along with the
the .exe. when build with Visual studio. It works fine, but for reasons I
won't go into I would rather not have the extra dll on the storage card( the
dll in the windows directory and on the card are exactally the same
version).
I noticed if I delete the dll version on the Storage card the program
faults with a type load exception when
it first calls a function in opennetcf.
Apperently the apps I have built and deployed to the windows directory work
because there is a copy
of opennetcf.dll is in that directory.
The app I have deployed to the card does not work because the opennetcf dll
is not in the local directory
along with the app. If I copy the app from the card to the windows
directory it works.

I was under the impression that when an app searches for dll's it looks in
the current directory and
if not found it looks in the windows directory.

Is this not true?
Is there something unique about CF dll's?

Is there a way to force the app to look in a specific directory for needed
dll's?
 
P

Peter Foot [MVP]

Normally managed dlls are only accessible to applications in the same
directory as themselves - hence in the \Windows folder only applications in
the \Windows folder will see them. Additionally you can register a dll in
the Global Application Cache (GAC), here assemblies are still located in the
windows folder but will be accessible from any managed application on the
device. This would be the best solution in your case so you can have a
single set of OpenNETCF dlls for applications in a variety of locations. You
can add an existing assembly to the GAC by adding a .GAC file to the windows
folder. This is a text file containing the full path to the dlls, and when
the runtime next loads these dlls will be added to the GAC. However if your
ROM image doesn't have the dlls already registered in the gac, they'll
actually be moved to RAM.

Peter
 
A

A. User

Thanks Peter, Just the info I needed!
I created the .GAC file and placed it in the \windows directory along with
the other dlls.
Worked great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top