TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
pratik mehta
NA
6
0
Register, Start and Install Com+ dll during installation
Feb 15 2010 5:43 AM
Hi.. I am making an installer.
I want to register , start and install my com component dll during the installation.
So I wrote the following code... (Custom Action) ..... It works absolutely fine but the problem is i have to hardcode the svcutil and installutil exe path.... is there anyway to avoid this?
And one more question do I have to Set any Credentials for this operation? As still I didn't test on the Other machine..
[RunInstaller(true)]
public partial class RegisterSvc : Installer
{
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
if (ExecuteRegCommand(Context.Parameters["target"].ToString() + Context.Parameters["dllname"].ToString()))
ExecuteInstallUtilCommand(Context.Parameters["target"].ToString() + Context.Parameters["dllname"].ToString());
}
public Boolean ExecuteRegCommand(string command)
// REGISTER THE COMPONENT DLL
{
if (ExecuteCommand(Context.Parameters["regsvcspath"].ToString(), command))
{
// START THE COMPONENT SERVICE
var objAdmin = new COMAdmin.COMAdminCatalog();
objAdmin.StartApplication(Context.Parameters["componentname"].ToString());
return true;
}
return false;
}
public Boolean ExecuteInstallUtilCommand(string command)
// INSTALL COMPONENT
{
ExecuteCommand(Context.Parameters["installutilpath"].ToString(), @"/url=""" + Context.Parameters["urlpath"].ToString() + "\" " + command);
return true;
}
Boolean ExecuteCommand(string fileName, string command)
{
try
{
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo(fileName, command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
Console.WriteLine(result);
return true;
}
catch (Exception objException)
{
return false;
}
}
}
Reply
Answers (
1
)
How to Check whether the Exchange Server 2003 is installed on Target computer while making installer?
how to setup console application project in three different environments