RE: Registering a custom DLL after deployment - advice?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Rich,

You do not have to use bat files - you can ask .Net setup & deployment
project to do this for you - just add the tlb to the output (which I believe
you already do), and set its Register property to vsdraCOM.

Anyhow, if you want to run a batch file and delete it after completion, you
will need to get the started process reference and wait for its completion,
similar to the following:
p.Start();
p.WaitForExit();


"Rich" wrote:

I use "Click Once" Deployment from VS2005. Works like a charm. I have to
deploy a console app and an MS Access ADP. The console app invokes the ADP.
I copy the ADP to the application files to be deployed from the console app
and then use the Process obejct to invoke the ADP on the end User's
workstaion. Below in this post is the code I use in the console application.


Anyway, I have had to add some additional functionality to the ADP in the
form of a dll I wrote in .Net which uses .Net objects (sqlDataAdapter for
reading data from Sql Server, StreamWriter for writing data to a Text File).
The DLL works fine.

My plan is this: On deployment, I will deploy a copy of the DLL (and tlb)
file(s) and a .bat file for registering the dll on the end user's workstation
on first usage of the deployment. But I don't want to keep re-registering
the dll everytime the enduser invokes the ADP (from the console app which
will be a shortcut on the endusers workstation). So I am thinking I will
delete the .bat file after first usage. Then, on the next deployment, the
.bat file wll be avaiable again for usage. Here is the code:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;
namespace SubscriberClientRnD
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//my version - as of 11/17/06
Process p = new Process();
if (File.Exists("./RegisterEntireListDLL.bat") )
{
p.StartInfo.FileName = "./RegisterEntireListDLL.bat";
p.Start();
File.Delete("./RegisterEntireListDLL.bat");
};
p.StartInfo.FileName = "./subscriberRnD.adp";
p.Start();
}
}
}

One question I have is if this is a good way to invoke the .bat file - using
Process. Then, I am guessing that by invoking .bat this way - it is
asynchronous and maybe I should use threading to make the app sleep for 500ms
before deleteing the file?

Any suggestions appreciated.

Thanks,
Rich
.



Relevant Pages

  • RE: Registering a custom DLL after deployment - advice?
    ... Register property to vsdraCOM - and leave the output as content ... I added the dll and the tlb and set the build action to ... publishing and invoke the .bat file. ... The custom dll is for the Access ADP. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Registering a custom DLL after deployment - advice?
    ... The custom dll is for the Access ADP. ... The console app invokes the ADP. ... On deployment, I will deploy a copy of the DLL ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Registering a custom DLL after deployment - advice?
    ... I tried making a reference to the com dll, ... register the dll on the destination workstation. ... publishing and invoke the .bat file. ... The custom dll is for the Access ADP. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to unzip a file ?
    ... lumping the dll into my own dir alongside my exe. ... Do I need to create a sub-folder called BIN before I run this bat file ... code with .Net 1.1 assemblies and code in VS2003 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to HANDLE an Access Violation error
    ... > to occupy contiguous memory. ... or dll, including disassembled code if you need it. ... The following in a bat file will get you most everything except the actual ...
    (microsoft.public.vb.winapi)