Sumit
Sumit

Reputation: 3068

Install Msmq using C#

I am creating an installer for an Application that requires MSMQ to be installed, so if MSMQ is not installed, I need to install the msmq. So can MSMQ be installed using C# or any command??

I am using .net 4.0.

Thanks in advance

Upvotes: 7

Views: 7864

Answers (1)

Mathias Florin
Mathias Florin

Reputation: 88

Can you try to launch a sub-process with:

using (Process process = new Process())
{
 process.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\" + "pkgmgr.exe";
 process.StartInfo.Arguments = "/iu:MSMQ-Container;MSMQ-Server";
 process.StartInfo.CreateNoWindow = true;
 process.StartInfo.ErrorDialog = true;
 process.StartInfo.UseShellExecute = false;
 process.Start();
 process.WaitForExit();
}

Upvotes: 0

Related Questions