Results 1 to 2 of 2

Thread: [2.0] Run regasm from windows application

  1. #1

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    [2.0] Run regasm from windows application

    I'm trying to run regasm on several dlls in a batch routine. I'm using the following code to try to accomplish this task however it doesn't seem to be working to register the dlls. I was trying to redirect the console input and output to determine if the registration failed or passed.

    Code:
    FileInfo regasmExe = new FileInfo(winDirectory + @"\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe");
    
     if (!regasmExe.Exists)
        throw new FileNotFoundException("The regasm.exe doesn't exsit in " + regasmExe.Directory.FullName);
    
     ProcessStartInfo startInfo = new ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\Cmd.exe");
                    startInfo.RedirectStandardInput = true;
                    startInfo.RedirectStandardOutput = true;
                    startInfo.CreateNoWindow = true;
                    startInfo.UseShellExecute = false; 
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    startInfo.WorkingDirectory = regasmExe.DirectoryName;
    
                    process = Process.Start(startInfo);
    
                    foreach (Assembly file in assemblies)
                    {
                        if (file.Exists == true && file.Register == true)
                        {
                            process.StandardInput.WriteLine(String.Format("{0} {1} {2}", "regasm.exe", file.Filename, @"\codebase"));
                            OnOutput(process.StandardOutput);
                        }
                    }
    If anyone has tried to accomplish this type of task before or has a tip that would be great.

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [2.0] Run regasm from windows application

    I think a batch file would be much easier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width