Getting ScriptTask source code in SSIS 2008
I used to get the source code of my script tasks using the code below in SSIS 2005.Now there is no ScriptTaskCodeProvider class in SSIS 2008.Does anyone know how to get the source code using 2008?ScriptTaskCodeProvider codeProvider = new ScriptTaskCodeProvider(); codeProvider.LoadFromTask(scriptTask); sourceCode = codeProvider.GetSourceCode( String.Format("dts://Scripts/{0}/ScriptMain.vsaitem", scriptTask.VsaProjectName));thankjimmy
December 4th, 2008 9:05am
if a package is saved to a xml file in code, then that code can parse that xml file and extract the script task code. afaik, script task code cannot be precompiled in ssis 2008, so this shouldn't present an issue.
hth
Free Windows Admin Tool Kit Click here and download it now
December 4th, 2008 10:50am
Hi Jimmy,Yes it is possible. There is a property on the script task, which is not browsable (but its there) named ScriptStorage. It is of type: Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage. The property you have to access is ScriptFiles (Hashtable). You have to determine what key you should use to access the required script, but I think you will make it out from there.Let us know how it goes.
December 7th, 2008 9:29am
Hi,
I was trying to utilize the ScriptStorage in the script task / script component to get the source XML in order to traverse it for Lineage Ids. Problem is I keep getting "Name 'ScriptStorage' is not declared.".
Dim Storage As Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage = ScriptStorage
Can you please post an example of how I access ScriptStorage? I am sure the above is incorrect.
Thank you,
Ron
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 11:34pm
Thank you for your response.
I have tried 3 methods
Dim ps As Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage = MyBase.ScriptStorage
Dim ps2 As Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage = Me.ScriptStorage
Dim ps3 As Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage = ScriptStorage
All 3 variations give a "is not a member" error
Do you have a sample of how it should work? either c# or vb is fine.
thank you,
Ron
Thank you, Ron
July 15th, 2011 11:22am
Hi,
I was trying to utilize the ScriptStorage in the script task / script component to get the source XML in order to traverse it for Lineage Ids. Problem is I keep getting "Name 'ScriptStorage' is not declared.".
Dim Storage As Microsoft.SqlServer.VSTAHosting.VSTAScriptProjectStorage = ScriptStorage
Can you please post an example of how I access ScriptStorage? I am sure the above is incorrect.
Thank you,
Ron
Can you post the complete script you are testing? Have you tried MyBase.ScriptStorage or Me.ScriptStorage ?SSIS Tasks Components Scripts Services | http://www.cozyroc.com/
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 12:14pm
Ron,
My mistake for not checking what you are trying to solve. The answer is still valid when the script creation is done from outside SSIS. This code will not work from inside the Script Task / Component. The script is contained in the so called host object
and this is very different from the object , which controls the host. I don't think you can access the script from inside the script.
Btw the Script Task and Script Component implementations are very different animals.
If you want to traverse lineage ids from inside SSIS you will need third-party solution like CozyRoc
Package Connection Manager. It provides access to the Package object.SSIS Tasks Components Scripts Services | http://www.cozyroc.com/
July 15th, 2011 3:05pm


