Results 1 to 6 of 6

Thread: Copy a file in the GAC

  1. #1
    Join Date
    Dec 2009
    Posts
    296

    Copy a file in the GAC

    Hello,
    In the context of a project, I must copy "/", install a dll in the GAC (Global Assembly Cache) Windows (located in C: \ Windows \ assembly). I tried with a simple renameTo method but it always returns me false. I want to copy a file in a GAC. Does anyone know if there is a specific method to do this?Thank you in advance!

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Copy a file in the GAC

    Hello,
    Try this code,
    Code:
    File fl = new File("file.dll");
    File dt = new File(C:\\Windows\\assembly\\file.dll ");
    dt.createNewFile();
    FileInputStream fin = new FileInputStream(fl);
    BufferedInputStream buff = new BufferedInputStream(fin);
    FileOutputStream fouot = new FileOutputStream(dt);
    BufferedOutputStream bos = new BufferedInputStream(fouot);
    byte[] dt = new byte[2048];
    int nbRead = 0;
    try {
        while((nbRead = ca.read(dt)) != -1) {
            bos.write(dt, 0, NbRead);
            bos.flush();
        }
    } catch(IOException ioe) {
        ioe.printStackTrace();
    } finally {
        bos.close();
        ca.close();
        fouot.close();
        did.close();
    }

  3. #3
    Join Date
    Dec 2009
    Posts
    296

    Re: Copy a file in the GAC

    Hi,
    Thank you for the answer. So finally I went by a circuitous route, I install the DLL via gacutil-i myDll.dll and then I run my java program from the dll to use. By cons now I want a way to recover the publicKeyToken the DLL in question. I read the binary dll but (or rather) publicKeyToken that appear do not match Is there an API / method in Java to manage the GAC?

  4. #4
    Join Date
    Dec 2009
    Posts
    192

    Re: Copy a file in the GAC

    Hello,
    Even I have a similar kind of problem, if you guys have any solution for this then please do post back. This is what i do.
    Code:
    SET assembly = WPSubscription
    SET = web config.config
    
    Registration echo%% assembly in the GAC ...
    C:\ Program Files\ Microsoft Visual Studio 8\ SDK\ v2.0\ Bin\ gacutil " -i%% assembly.dll
    
    echo.
    echo Recording of data in data.txt...
    C:\ Program Files\ Microsoft Visual Studio 8\ SDK\ v2.0\ Bin\ gacutil " / l% Assembly%> data.txt
    
    echo.
    echo Generation of assembly xml file%%.dll
    C:\ Program Files\ Java\ jdk1.5.0_07\ bin\ java cp - "." %% WebPartDeployer assembly.dll % config%

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Copy a file in the GAC

    Hello,
    Try this the following code.
    Code:
    File fil = new File("file.dll");
    File f2 = new File(C:\\Windows\\assembly\\file.dll ");
    f2.createNewFile();
    FileInputStream fin = new FileInputStream(fil);
    BufferedInputStream buff = new BufferedInputStream(fin);
    FileOutputStream fouot = new FileOutputStream(f2);
    BufferedOutputStream bos = new BufferedInputStream(fouot);
    byte[] f2 = new byte[2048];
    int nbRead = 0;
    try {
        while((nbRead = ca.read(f2)) != -1) {
            bos.write(f2, 0, NbRead);
            bos.filush();
        }
    } catch(IOException ioe) {
        ioe.printStackTrace();
    } finally {
        bos.close();
        ca.close();
        fouot.close();
        did.close();
    }

  6. #6
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Copy a file in the GAC

    Hello,
    It is very hard to copy files for Global Assembly Cache, they are situated at C:\windows\ass.. If you want to see the properties of the assembly files then you just have to right click on the file and view the properties from there. But If I am not wrong then some times you do not have any other option that just copy pasting the file because you can not edit it and you do not really know what to do.

Similar Threads

  1. Replies: 5
    Last Post: 13-06-2012, 02:04 PM
  2. batch file to copy file to another place
    By bomblast in forum Windows Software
    Replies: 1
    Last Post: 03-11-2011, 12:53 AM
  3. Replies: 4
    Last Post: 25-10-2010, 11:59 AM
  4. Replies: 3
    Last Post: 12-03-2009, 12:56 PM
  5. cannot copy ISO file of 4gb
    By Catchkuber in forum Windows Software
    Replies: 3
    Last Post: 27-12-2008, 11:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,486,280.42034 seconds with 17 queries