In my Project, I want to create one empty text file when the package triggered.
Asked
Active
Viewed 7,234 times
2 Answers
8
I'd probably just use a one-line Script task.
System.IO.File.Create(@"C:\OneEmptyTextFile.txt");
- On your Control Flow, drag a Task of type
Script Task
from your SSIS Tool Box - Double click on the new
Script Task
- In the Script Task Editor, click
Edit Script...
- In the
public void Main()
section, where it states// TODO: Add your code here
replace that line with the above code. If you are using SSIS 2005 or if you have chosen to use VB.NET in 2008/2012, please remove the trailing semicolon. - Click the X button in the upper right corner of the Integration Services Script Task window
- Back in the Script Task Editor, click
OK
.
Now whenever that Task runs, it will use the static Create method of the File object to create a file in the requested location.

billinkc
- 59,250
- 9
- 102
- 159
-
Thanks for sharing but could you please elaborate more about it, I am new to Script task. – 343 Jan 04 '13 at 18:39
0
It might be good idea to dispose of the FileStream
object after using the File.Create
method to avoid locking issues.
Read more here System.IO.File.Create locking a file