0
votes
  • I have a custom EXE written in C# (I didn't write it). It retrieves data from MongoDB and writes six CSV files to the same folder that it resides in.

  • I can double-click on the EXE and run it -- I do need to run it as an administrator. I have its administrator privileges set in the properties, so it always runs as administrator. It pops up a window with some status messages, then closes without prompting after creating the files.

  • I have the same EXE listed in an "Execute Process" task in SSIS (VS 2015, pointed to SQL Server 2012). When I run it, it pops up the same cmd window, gives the same status messages, closes without prompting, and continues to the next step in my SSIS package... BUT it doesn't write any files.

  • I gave "Everyone" permissions to the target folder, which doesn't seem to have helped. What do I need to do?

1
Are you sure it writes to the same folder as the EXE, and not the "Current" folder, which can be anything? - ESG
@ESG, that's completely right! It's putting the files into 'Microsoft SQL Server/110/DTS/Binn'. AWESOME, thank you. How do I get this process task to put them in the location I want automatically? I will be running this from other computers, so not sure where the target directory will sit. WorkingDirectory property? - Quicksilver
When you execute something from windows explorer, it runs it from the current folder. Not the same can be said of SSIS when it creates a process. Did you set anything in your task's property for the "Working Folder" option? - ESG
@ESG, I edited my comment, but you are completely right. Thank you. I don't think I can mark your comment as an answer -- I'll come back later after I've tested the workingdirectory property. - Quicksilver

1 Answers

2
votes

When the process is launched from SSIS, it's not being run from the same folder as the executable. That's pretty typically of any software executing an external process.

Fortunately, you can set the "working folder" option within the Execute Process task properties. If your executable is written to write to the current folder, it should work.