GAC & Assembly Versions For Same DLLs

G

Guest

I am trying to understand how to efficiently use the GAC, but I am having a
problem with an application I want to deploy to my handhelds. Specifically,
this application uses System.Web.Services.dll as it uses a web service. My
environment is Pocket PC 2003 Phone Edition and a version of this dll is
already contained in the .NET CF.

The version I need to use is 1.0.2268.0. The current version on the device
is 1.0.3111.0. If I deploy my application w/o placing my DLL in the same
directory, I receive a TypeLoadException error. I can make it work by placing
my DLL alongside my application. Rather, I would like to place my
System.Web.Services.dll into \Windows\ and use my own GAC file (containing
"\Windows\System.Web.Services.dll") to register it. That seems to work as I
can verify it in the Registry under
\HKLM\SOFTWARE\Microsoft\.NETCompactFramework\Installer\Assemblies\3rd
Party\. As I am using this DLL in other applications and in other directories
as well, I want to maintain it in one location rather than having it to copy
into the same directory where my applications reside - I'd have multiples of
the same.

Although the versions are different, both DLLs are entered as 1.0.5000.0 in
the registry. My feeling is that my application is still attempting to use
the newer of the two DLLs. If this is the problem, how can I explicitly tell
my application to use the DLL versioned 1.0.2268.0?
 
G

Guest

During further research, I determined the dll already on the device and the
dll I'm putting down both work although the file version differs. I may have
been on the wrong track there.

What I did was copy
\windows\GAC_System.Web.Services_v1_0_5000_0_cneutral_1.dll to \<my
application's directory>\System.Web.Services.dll. Executing the application
then worked as it treated this dll as a private assembly. Now that I know the
dll on the device worked, I am faced with the problem that I cannot seem to
get it working in the GAC. I receive a TypeLoadException error when I remove
this dll from my application's directory again and attempt to use the one in
the GAC.

I have several applications in various directories that require the use of
web services and I want to prevent having to copy the same dll to all
directories. Distributing these files over GPRS rakes up the KB/month - I
don't have unlimited data plans - and this should not be the way it should be
done - this file should be loaded dynamically from the GAC.

Can anyone help, please?
 
G

Guest

Instead of using the library I created from the source file I generated with
WSDL.exe, I just added the source file to my project. As I don't need to
share this code with other applications, this works for me. Not only did I
save myself the dll I previously generated (bear in mind that my
executable/assembly is now inflated due to including the source file - no
space gain there), but I also circumvented the problem I had with having to
use System.Web.Services.dll as a private assembly rather than the GAC'ed DLL.
I'm still not solving the problem, but I can get around it now.
 

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