RE: Registering a custom DLL after deployment - advice?
- From: Sergey Poberezovskiy <SergeyPoberezovskiy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Jul 2007 20:56:00 -0700
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
- Follow-Ups:
- Prev by Date: read the values from a excel row
- Next by Date: read the values from a excel row
- Previous by thread: read the values from a excel row
- Next by thread: RE: Registering a custom DLL after deployment - advice?
- Index(es):
Relevant Pages
|