Techna

I have been creating .Net DLLs for use in smart device projects.

I want to install shared assemblies into a single location. From what I understand these should be added into the GAC using cgacutil.exe or a text file in the windows directory ending .gac listing the DLLs. Both methods work for fine for adding the DLLs and the applications use the shared DLLs.

I am a bit concerned about removing the DLL from the GAC. I have used cgacutil.exe -u to uninstall the DLL from the GAC but it is still showing in the Windows directory. I would like these removed to save space as when the DLLs are updated the old versions will not be used.

I have found it difficult to find information on shared assemblies with the compact framework. Is there a solution for this or a better method to use



Re: .NET Compact Framework Shared Assemblies & GAC

Ilya Tumanov

GAC is intended for assemblies which are shared across applications. Thus GAC keeps reference count for each assembly and only removes an assembly if reference count reaches zero.

Generally you just need to include .GAC file which lists assemblies to GAC into your CAB and that¡¯s it.

Uninstalling the CAB would lead to deletion of a GAC file which would be noted by NETCF (next time any managed application is executed).

If that was the last reference to that assembly, it would be removed from GAC.

If you not planning to share an assembly across applications then there¡¯s no need to GAC it.






Re: .NET Compact Framework Shared Assemblies & GAC

Techna

Thanks for your reply.


It is likely that the assemblys will be shared but this may not be the case in all situations.


The main reason for sharing assemblys is to avoid re-deploying a CAB file of 3MB+ over GPRS to 600+ users when the only change is to a single DLL of 50K. All application CAB DLL's are all reinstalled when an update is downloaded and the references in the application project are not version specific.


The old GAC DLL and the new are both present in the windows directory and because of this I assume the application will use the old DLL.


Can you recommend a way to achieve this functionality





Re: .NET Compact Framework Shared Assemblies & GAC

Ilya Tumanov

CAB files do not support upgrade. WM 5.0 and above would uninstall previous version of the CAB thus removing assembly from GAC and your ¡°partial¡± CAB won't work.

You have to either isolate shared components into separate CAB or implement your own upgrade logic in setup DLL (native C++ only).

You can also update DLL in GAC with a new version. DLL is considered the same if it has same strong name. If several DLLs with the same strong name are GAC¡¯ed, DLL with higher Win32 version will be placed in GAC.






Re: .NET Compact Framework Shared Assemblies & GAC

Techna

If DLLs are downloaded to '\DLLs' and a new DLL is downloaded with the same strong name will the new DLL be added to the GAC when a NETCF application runs

Thanks





Re: .NET Compact Framework Shared Assemblies & GAC

Ilya Tumanov

Not sure, I would say no. Even if it works I would not do it as it¡¯s undocumented and can change at any time.






Re: .NET Compact Framework Shared Assemblies & GAC

Techna

So basically to install and uninstall DLLs in the GAC i should have a CAB installer and a .GAC file listing the DLLs.

Thanks