Question:
VB .NET Class Library Problems?
DLL Jedi
2006-01-31 05:12:13 UTC
Why DLL have to recompiled on target PC for it to be used?
I created a dll with VB .NET Class Library Project Type. The DLL will show one dialog window when client program calls its function. I used regasm executable to register my DLL in the target PC. But the DLL didn't work. I have to compile the dll in the target PC, then it works. It's ridiculous to recompile the dll in the target PC before using the dll. Even in my PC sometimes it works and sometimes not. Can somebody help me with this,

I tried to change the AssemblyVersion setting to 1.0.0.1. Compiled and register the same dll in the targer PC. And it still doesn't work. Anyway, what is Global Assembly Cache? How to register dll into it?
Three answers:
frankfazzio
2006-01-31 05:19:47 UTC
The Global Asembly Cache is where you put shared assemblies in .Net. A shared assembly has members that can be called by other assebmlies without having to be physically in the same directory.



Your .Net resources should make reference to the "gacutil" utility that does this job for you. But, you have to have a "strongly named assembly" to do this, which requires the Assembly version to be static (not have the *, which you already have done), and have a public/private key set (created by the "sn" utility). Also, "gacutil" is a development tool. Once your product is "finished", add a .Net setup project (using the Setup Wizard) to generate an install program that will install your program and register your share assemblies automatically.



Addressing the first issue, I move DLL's to target PC's all the time without having to recompile or register with regasm. Regasm is supposed to be used to allow .Net assemblies be called by COM component. Since you feel you need to use regasm, do the members in the DLL refer externally to any non-.Net resources, controls, etc?
Vikky Belani
2006-01-31 13:25:18 UTC
I dont think you have to recompile the dll on the target machine...



I will try and reply you on this later in the day..



Regarding the GAC..it is a machine-wide .NET assemblies cache for Microsoft's CLR platform. If you put your assembly in GAC that particular assembly will be available for use by multiple applications on that computer.



For registering the assembly into GAC the assembly should have a strong name i.e version, public key token,culture..

This link will show you how to sign the assembly with strong name...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconAssigningAssemblyStrongName.asp



Once you are done with strong name put your assembly in c:\windows\assembly

or there is one more way...through a UI



I hope it will be helpful to you..



Thanks,

Vikky
2006-01-31 13:39:27 UTC
www.programmingtutorials.com/vbnet.aspx


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...