![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I initiate MSMDARCH.exe using the Program.Start() method in c# which is supposed to unpack a CAB file used for an OLAP cube in MS Analysis Services: public static bool unpackDTSCAB(string dBServerName) { bool DTSSuccessfullyConfigured = false; try { // unpack the CAB file string ExePath = Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles) + @"\Microsoft Analysis Services\Bin\msmdarch.exe"; string MSMADataPath = Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles) + @"\Microsoft Analysis Services\Data\"; string DTSCabPath = CommonConfigUtils.FindFile(@"\OLAP\OLAP_DB\TEST.CA B"); if (DTSCabPath == "" || DTSCabPath == null) return false; string parameters = "/r " + dBServerName + " " + MSMADataPath + " " + DTSCabPath; ProcessStartInfo ps = new ProcessStartInfo(ExePath,parameters); ps.UseShellExecute = false; ps.RedirectStandardOutput = true; ps.RedirectStandardError=true; Process newProcess = new Process(); newProcess.StartInfo = ps; newProcess.Start(); newProcess.WaitForExit(); DTSSuccessfullyConfigured = true; // the standard output and standard error do not appear to typically produce any feedback // If something is ever returned, we will consider it an error string outputString = newProcess.StandardOutput.ReadToEnd().ToString(); if (outputString.CompareTo("") != 0) // if output string is not empty, throw error output throw new SystemException(outputString); } catch(Exception ex) { Trace.WriteLine(ex.Message); return false; } return DTSSuccessfullyConfigured; } The problem is that even though the method completes successfully, it fails to create an OLAP cube instance in the MS Analysis Services Manager. Strangely, the Process.Start()code almost never produces an exception, unless there is something wrong with the ".exe" path. I am looking at the STDOUT and STDERR for any sign of success or failure and get absolutely nothing. Another strange thing is that if I stop execution of the code with the debugger just before the Process.Start() method and copy the values for the exe string and parameters string in a command console, it successfully creates the OLAP cube in MS Analysis Services. However, like the code, it produces no feedback on the command line for errors in the parameters. So I'm looking for any info on: - how to successfully run MSMDARCH.exe from c# code with feedback or at least some measure of whether or not it was successful. OR - another way to unpack the ".cab" file I am running Win2003Ent, SQL2003SP3, MSAS SP3, in the .Net 2.0 framework Any help or direction is much appreciated. Thanks. |
#3
| |||
| |||
|
|
Managed to get at least a success/failure using the exit code property of the instantiated process object if (newProcess.ExitCode == 1) DTSSuccessfullyConfigured = false; - but you have to make sure that you use the WaitForExit() method. I would still like to know if anyone has any ideas about why using MSMDARCH.exe fails when running it through .Net Process.Start(), yet succeeds when the MSMDARCH.exe executable is run manually at the command line. Ideas? comments? suggestions? Thanks, thotman wrote: I initiate MSMDARCH.exe using the Program.Start() method in c# which is supposed to unpack a CAB file used for an OLAP cube in MS Analysis Services: public static bool unpackDTSCAB(string dBServerName) { bool DTSSuccessfullyConfigured = false; try { // unpack the CAB file string ExePath = Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles) + @"\Microsoft Analysis Services\Bin\msmdarch.exe"; string MSMADataPath = Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles) + @"\Microsoft Analysis Services\Data\"; string DTSCabPath = CommonConfigUtils.FindFile(@"\OLAP\OLAP_DB\TEST.CA B"); if (DTSCabPath == "" || DTSCabPath == null) return false; string parameters = "/r " + dBServerName + " " + MSMADataPath + " " + DTSCabPath; ProcessStartInfo ps = new ProcessStartInfo(ExePath,parameters); ps.UseShellExecute = false; ps.RedirectStandardOutput = true; ps.RedirectStandardError=true; Process newProcess = new Process(); newProcess.StartInfo = ps; newProcess.Start(); newProcess.WaitForExit(); |
![]() |
| Thread Tools | |
| Display Modes | |
| |