Hi,
Thanks for your reply. Actually the 3 lines of code that I have mentioned is taken from this blog. The problem happens when I try to get the object for DataProfilingTask which is already added in the Package.
For me the following line return null, so I cannot really do anything with that.
var dpt = task.InnerObject as DataProfilingTask;
I also tried adding a new DataProfilingTask to the package instead of just loading an existing one using following code.
var pkgType = typeof(Microsoft.SqlServer.Dts.Tasks.DataProfilingTask.DataProfilingTask).AssemblyQualifiedName;
Executable exec = pkg.Executables.Add(pkgType);
And I get following exception :
Error: {0}Cannot create a task from XML for task \"\", type \"\" due to error 0xC001F430 \"An error occurred while accessing an internal object. This could indicate a custom extension built for Integration Services 2005 is being
used.\".\r\n"