Global Assembly Cache

D

DDE

Hi,

I have built an assembly, put in in the global assembly cahe and registered
it. I would like to be able to use this assembly in our different Web
Services just by the "using" directive, without having to add it as a
/reference when compiling my Web Services. I mean the same as for
"System.whatever" that you declare with a using directive but do not have to
reference at compile time. How is it possible to achieve that?

ps: I am not useiong Visual Studio .Net

Thanks,

Dominique
 
B

Bob Powell [MVP]

You still need to add a reference. You'll add the reference to the DLL but
you'll see that when it's in the CAG the DLL, wherever you actually
reference it from will not be copied into the run directory of your
application and the app will use the one in the GAC.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com
 
D

DDE

Thanks Bob,

Just to be sure, does it mean there is really NO way to avoid to have to add
the /reference in the csc command? Than how does it work with standard
assemblies like System.IO etc ... ?

Thanks

Dominique
 
J

Jon Skeet [C# MVP]

DDE said:
Just to be sure, does it mean there is really NO way to avoid to have to add
the /reference in the csc command? Than how does it work with standard
assemblies like System.IO etc ... ?

It uses the default response file, which you can also do with @...

The default one is in the same folder as csc.exe, and is called
csc.rsp. My one is:

# This file contains command-line options that the C#
# command line compiler (CSC) will process as part
# of every compilation, unless the "/noconfig" option
# is specified.

# Reference the common Framework libraries
/r:Accessibility.dll
/r:Microsoft.Vsa.dll
/r:System.Configuration.Install.dll
/r:System.Data.dll
/r:System.Design.dll
/r:System.DirectoryServices.dll
/r:System.dll
/r:System.Drawing.Design.dll
/r:System.Drawing.dll
/r:System.EnterpriseServices.dll
/r:System.Management.dll
/r:System.Messaging.dll
/r:System.Runtime.Remoting.dll
/r:System.Runtime.Serialization.Formatters.Soap.dll
/r:System.Security.dll
/r:System.ServiceProcess.dll
/r:System.Web.dll
/r:System.Web.Mobile.dll
/r:System.Web.RegularExpressions.dll
/r:System.Web.Services.dll
/r:System.Windows.Forms.Dll
/r:System.XML.dll
 
D

DDE

Hi again,

I followed your directions, but now I get another Error message when
compiling: CS0006 Metedata file ..... could not be found.
Could you please list all the steps required ?
This is what I have done
1) compile my assembly
2) Out it in the GAC ( drag&drop)
3) register it with regasm
4) add it to csc.rsp file

Thanks again

Dominique
 
J

Jon Skeet [C# MVP]

DDE said:
Hi again,

I followed your directions, but now I get another Error message when
compiling: CS0006 Metedata file ..... could not be found.
Could you please list all the steps required ?
This is what I have done
1) compile my assembly
2) Out it in the GAC ( drag&drop)
3) register it with regasm
4) add it to csc.rsp file

What happens if you just use /r from the command line rather than it
being in the response file? What *exactly* is the error message (please
cut and paste it).
 
D

DDE

In the meantime I found a solution, I had to add the path to the DLL in the
response file instead of mentionning only the DLL name or I suppose I could
have placed the DLL in a path declared in the environment. What I am trying
to figure out now is the cleanest way to do the thing, what codebase to
use, where should be the DLL be placed at compile time and runtime, and
further more how to deploy and register the Web Services and related common
assemblies to another system. I suppose I have to make some more reading
about that or maybe you can point me to some specific documentation.

Dominique
 
J

Jon Skeet [C# MVP]

DDE said:
In the meantime I found a solution, I had to add the path to the DLL in the
response file instead of mentionning only the DLL name or I suppose I could
have placed the DLL in a path declared in the environment. What I am trying
to figure out now is the cleanest way to do the thing, what codebase to
use, where should be the DLL be placed at compile time and runtime, and
further more how to deploy and register the Web Services and related common
assemblies to another system. I suppose I have to make some more reading
about that or maybe you can point me to some specific documentation.

If it's in the GAC, I wouldn't expect you to have to specify the full
path...

I don't know of any particularly good resources about this though, I'm
afraid.
 

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