none
GACUTIL PROBLEM IN ASSEMBLY

    General discussion

  • Hi I have a doubt in the gacutil coding of assembly.. The code is as below

    <tt>gacutil /il assemblyList.txt</tt>

    The question arises is that how the <tt>gacutil /il assemblyList.txt is created in assembly.As in assembly we have seen that only "GAC" file is created</tt>

     

    Thanks

     

     

    Thursday, April 21, 2011 12:52 PM

All replies

  • Hi,

    sorry, but I am unable to understand you fully. The gacutil program is used to install or unainstall assemblies into the Global Assembly Cache.

    See http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx for details.

    Can you describe your problem or question please so that I understand you? Are you looking at the GAC and you do not find what you expect? Then please give us more details (which version of .Net are you using, what did you do exactly, what do you see where) and we might be able to explain all to you.

    With kind regards,

    Konrad

    Thursday, April 21, 2011 1:08 PM
  • Hi

    I am working on version of 4.0 of .Net .The link which you have given to me  i am stdying from that link only but i'm not trying to get how these problem could be sort out.

    How gacutil /il assemblyList.txt is created in assembly? When i am trying to access then I couldn't find any file related to ".txt"

     

    Thanks

    Thursday, April 21, 2011 1:21 PM
  • Hi,

    what do you mean with "How gacutil ... is created in assembly"? Nothing is created in an assembly.

    You create assemblies when compiling stuff. These assemblies can be installed inside the GAC (but must not! If you do not know what you are doing, then I would recommend to keep at the basics and just store all dependencies together with your binaries). You can install an assembly into the gac through the command

    gacutil /i someassembly.dll

    where someassembly.dll is the assembly you created.

    if you want to install multiple assemblies but do not want to call gacutil multiple times, you can create a simple text file with all files inside that should be installed, e.g. "assemblylist.txt" could be created with this content:

    assembly1.dll

    assembly2.dll

    assembly3.dll

    So when you call gacutil /il assemblylist.txt, these 3 assemblies are installed inside the gac.

    If you want to write such a textfile in your code (if that is meant with your question), then you can simply write the text file (e.g. using the StreamWriter class) and then call gacutil /il with the created file through the Process class. The MSDN Library documents these classes and even gives some easy examples.

    I hope this helped and sorry if I still didn't got you right. I have very big problems understanding the 2nd paragraph "How gacutil .... related to ".txt"".

    With kind regards,

    Konrad

    Thursday, April 21, 2011 2:34 PM
  • Ya i understand your concern.. Anyways thanks for guiding me..

    But after writing gacutil /i someassembly.dll command it gives me the error

     

    Failure adding cache to assembly-- The system cannot find the path of file..

     

    With Warm Regards

    Abhishek

    Thursday, April 21, 2011 2:57 PM
  • Hi,

    thank you for the additional information.

    The error message shows, that gacutil cannot find the file someassembly.dll. So I would suggest, that you try these steps:

    a) Open a Visual Studio Command Prompt.

    b) Go into the directory where someassembly.dll is

    c) Try the cpmmand again. Now gacutil should find the file. (Make sure that the file is there with "dir someassembly.dll".

    Another solution could be to give gacutil the full path to the file. If you want to do this, then you could do these steps:

    a) Open a Visual Studio Command Prompe.

    b) Enter "gacutil /i " (Without quotes, do not press the enter key!)

    c) Open the Windows Explorer and find the assembly you want to add.

    d) Drag and drop the file from the Windows Explorer window to the visual studio command prompt window. a "c:\somewhere\someassembly.dll" is added behind the command you typed already. Just commit the command with the enter key.

    With both ways you should no longer get the given error message. Hopefully, you get some success messages now.

    With kind regards,

    Konrad

    Friday, April 22, 2011 7:37 AM
  • Hi sir.. After compiling it shows me the "Unknown Option :and "

     

    I have follow instructions according to your answer like gacutil / i " path where assembly is created\bin \Debug\ClassLibrary1.dll .

     

     

    Thanks

    Friday, April 22, 2011 10:10 AM
  • Kindly "Help" me out ASAP

     

    Thanks

    Friday, April 22, 2011 11:25 AM
  • Hi. Why after Installing Assembly in GAC iam not getting the message that “Assembly successfully added to the cache” where the path is

    gacutil -i PublicClassLibrary.dll. I have created strong key also.

     

    Thanks

    Friday, April 22, 2011 11:35 AM
  • Hi,

    can you please provide the exact command that was commited to the system and the exact output of the command?

    This could look like this:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>gacutil /i ThisDoesNotExist.dll
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Failure adding assembly to the cache:   Das System kann die angegebene Datei nicht finden.


    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

    ==> The file simply does not exist. (The error message comes from the system and I have a german system. It is a "file not found" one.)

    or

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>gacutil /i ":\some\test.dll"
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Failure adding assembly to the cache:   Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.


    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

    ==> Some error in the syntax. I simply missed the drive letter. oups.

     

    If we get such information, then we maybe can see the error.

    With kind regards,

    Konrad

    Tuesday, April 26, 2011 5:10 AM
  • Hi, I am not getting the conclusion what are you trying to make it out? please be more specific

     

    Thanks

    Wednesday, April 27, 2011 1:29 PM
  • Hi,

    all I tried to tell you:

    Please give us more details what you are doing exactly and what exact error message you got.

    Withour further information all this is guessing around and that seems to lead to nothing.

    With kind regards,

    Konrad

    Wednesday, April 27, 2011 1:37 PM
  • Hi,

     

    As earlier discussed while declaring  the path of gacutil /i F:\Documents and Settings\abhishek\My Documents\Visual Studio 2010\Projects\PublicClassLibrary\PublicClassLibrary\bin\Debug\PublicClassLibrary.dll. I am getting the following results

    Microsoft <R>.Net Assembly cache Utility.Version 4.0.30319.1

    Copyrights <C> Microsoft Corporation.All right reserved

    unknown option :And

    That's it !!!

     

    Thanks & Regards

    Abhishek

    Wednesday, April 27, 2011 2:05 PM
  • The Path contains spaces so you have to put it in quotes:

    gacutil /i "F:\Documents and Settings\abhishek\My Documents\Visual Studio 2010\Projects\PublicClassLibrary\PublicClassLibrary\bin\Debug\PublicClassLibrary.dll"

    With kind regards,

    Konrad

     

    Wednesday, April 27, 2011 2:17 PM
  • After working it. It says that Failure adding assembly to the cache ----"Attempt to install a assembly widout a strong key "

     

    Thanks

    Wednesday, April 27, 2011 2:29 PM
  • But now the problem arises. How to create AssemblyList.txt file in an assembly ?

    Thanks & Regards

    Abhishek

    Wednesday, April 27, 2011 2:30 PM
  • You can create an AssemblyList,txt file and just put one line in with:
    F:\Documents and Settings\abhishek\My Documents\Visual Studio 2010\Projects\PublicClassLibrary\PublicClassLibrary\bin\Debug\PublicClassLibrary.dll

    Then you call

    gacutil /il "Full Path to the txt file"

    and you are done

    But it will not solve the signing problem. Just go into visual studio, go to the project settings of your assmebly and sign it. Just create a new StrongNameKey (snk file).

    As soon as you did that, you can add that dll to the GAC.

    If you do not want to do that, you can use the sn,exe (http://msdn.microsoft.com/en-us/library/k5b5tt23(VS.71).aspx) tool to create a snk file and then sign the dll.

    WIth kind regards,

    Konrad

    Wednesday, April 27, 2011 6:16 PM
  • Hi, How gacutil /il "Full Path to the txt file" will be posted in command prompt & which path of txt file will be written into it whether it is dll or some thing else?

     

    Thanks

    Thursday, April 28, 2011 2:54 PM
  • Hi,

    I don;'t know if i start a new thread will it be answered by Konrad Neitzel, so i am asking a queston in this thread itself.

    Question...

    I have a DLL with me in which i have created a component class. But as long as the project is open the Tool shows in the ToolBox, but the moment i open a new project, without the DLL project opened along with it, the Toolbox does not show me the Tool/Control/Component Class , which i have created.

    Also How do you create a .SNK file and why is it necessary.

    Also, when do we use REGASM.EXE and when to use GACUTIL.EXE

    Regards

    Bikram Grewal

     


    • Edited by Bikram Grewal Saturday, October 29, 2011 3:17 PM I put C instead of K for Konrad's name
    Saturday, October 29, 2011 3:16 PM
  • Hi Bikram,

    sorry for the delayed answer. I twisted my ankle so I wasn't active on MSDN Library in the last days.

    In general it is best to open a new thread in such a case, because
    - You asked some questions so the thread type should be question instead of discussion
    - A lot of people (even including me) are mostly reading new tasks and often skip older tasks due the lack of time.

    In general, you have to configure, which items you want to see inside the toolbox. You can easily add items to it. But you should always think about how to do it. One way is to really keep it as a seperate component. That means it is installed inside the GAC. So you could build an installer for it that can be included in any setup of depeneden projects. And once installed inside the GAC on your system, you can generally include it inside the toolbox of Visual Studio.

    Another way (which we like to do at work) is to keep the deopendencies outside the GAC. So for each project, you have to add the files of your dependency to your product (We create a folder inside the solution called dependencies where we place the files). This approach has the big advantage, that you have less work with versioning. Each of our solution brings the required files with it.

    A .SNK file can always be created either through commandline or just from inside Visual Studio. The Visual Studio way is always the simplest way. Just go into the project properties and under signing choose "new". If you have multiple projects, it can be a good idea to move the created .snk from the project directory to the solution directory and then choose this file inside the project properties.

    Also important: If you want to publish software, you should check verisign and get an official key to publish software. Then people can be sure, that the software comes from you and they can even trust you.

    Difference GACUTIL / REGASM:
    GacUtil is a tool to manage the global assembly cache. So you can install assemblies into the GAC or remove them.
    RegAsm is a tool to register Assemblies in windows. That has nothing to do with the GAC.

    Example:
    With GacUtil you can move an assembly to the GAC. This assembly must not be a COM component or so. It just has to be a .Net assembly. After installing the assembly inside the GAC, the .Net runtime (the loader part of it) is able to find load the assembly as soon as it is referenced (name, key, version and language are checked!).
    With RegAsm, you can register Windows Components inside windows. The assembly must not be installed inside the GAC. An example for this can be a COM Component that you want to use with other applications (e.g. a VB Script). you can put the assembly anywhere and call a "regasm /codebase ..." and afterwars windows will know about the COM component. (So a VBS command CreateObject("MyCoolComComponent") will work!)

    So you see the difference: One is a .Net thing to make an assembly available for other .Net assemblies. The other one is a Windows thing to make a component available for other Windows elements (Windows does not really care about the .Net thing. For Windows it will be a COM Component.)

    This windows component behaviour can easierst be seen with windows services. If you create a .Net windows service and check the registry keys, you will find a normal windows service. But some .Net parts are referenced as some kind of wrapper around your assembly.

    I hope this was helpfull for you and answered your question. The full details were left out a little bit. I just tried to give you an easy overview where I might presented you some kind of "black/white" world which is not fully true.

    With kind regards,

    Konrad

    Thursday, November 03, 2011 9:34 AM