I am working on c#.Net application using Arcobjects.NET, and I am using the IMathOp, but I am facing a problem in temporary files generated by arcobjects, I specified the workspace for the tool, bu sometimes it generates the temporary files into the application folder not into the workspace folder i specified, is there and solution to guarantee creating temporary files in my work space in order to clean it later.
I am specifying the work space as follows:
IMathOp mathOp = new RasterMathOpsClass();
IRasterAnalysisEnvironment mathOpEnvironment = (IRasterAnalysisEnvironment)mathOp;
workspaceFactory = new RasterWorkspaceFactoryClass();
workspace = workspaceFactory.OpenFromFile(@"c:\temp", 0);
mathOpEnvironment.OutWorkspace = workspace;
Please look at the documentation. It says rasterAnalysisEnvironment.SetAsNewDefaultEnvironment(); may be this will help as well.
To change the session default analysis environment, create the RasterAnalysis object. Change the settings of the analysis environment to those you want to make the default, then call the SetAsNewDefaultEnvironment method. The SetAsNewDefaultEnvironment method will not change the analysis environment associated with any existing operator objects, but each new operator object created will contain the default settings.
You can change environment settings and call the SetAsNewDefaultEnvironment method as many times as you want. To restore the previous set of defaults, call RestoreToPreviousDefaultEnvironment. You can call this method as many times as you have called the SetAsNewDefaultEnvironment method. To reset the global analysis environment to the original defaults, call the Reset method.
Thanks Shriram, unfortunately both solutions didn't works, the SDK is still generating files in exe path sometimes, and i can't figure out the issue, because if i run the same code with same input for 10 times for example, it generated the files for two or three times in exe folder and other times are working correctly and put files into the workspace.