Generating SSIS script component code programmatically
Hello,I'm working on a tool that creates SSIS packages which are necessary to upsize VFP data (dbf tables) into SQL server.Everything is working fine except the script components.In SQL 2005 creating and compiling script component code wasn't that hard to accomplish, but here in SQL 2008 with the change from using VSA to VSTA I'm not able to generate valid script code anymore.In some scenarios I have to insert a 'Script Component (Transformation)' between the Source and Destination Components.If I do so and execute the SSIS package I get the following error message:"Microsoft.SqlServer.Dts.Pipeline.CannotCreateUserComponentException: Cannot create user component class. Make sure there is one class marked with SSISScriptComponentEntryPointAttribute in your script."But this attribute is set in code. The way I'm creating the script code is by use of 'VSTAScriptingEngine' and 'VSTAScriptProjectStorage'. Everything seems to work fine till it comes to the actual execution of the script code - which is somehow rather important too :-)Do you have any ideas, advice, links, ... ?Thanks for help!-- robert.oh. --
November 27th, 2008 2:36pm

Hello Robert, Hope this can help you : https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=329101&wa=wsignin1.0
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2008 5:45pm

Hello Roman, Thanks for the link I've already changed the components from 'IDTS...90' to 'IDTS...100' and my programmatically created SSIS packages WITHOUT a script component run just fine. So there's definitely something wrong inside the script component, but what??? That's the question ...
November 27th, 2008 6:11pm

Ok. In this case you can do the following. 1. Create your package programmatically WITH ScriptTask (Package_1) 2. Create a second package programmatically WITHOUT ScriptTask (Package_2) 3. Open created package Package_2 in BIDS and add a ScriptTask manually 4. Compare two packages Package_1 and Package_2 for see a difference. The DTSX file is in XML format and you can easy find a differences.
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2008 7:24pm

Thanks for this suggestion. Already done so several times and used severalcomparison tools (likeWinDiff, ExamDiff, ...) but the packages / xml files are identical except the encoded script code part (base64 encoded string, I'd guess).
November 27th, 2008 7:29pm

Hello robert, And if you add ScriptTask manually in programmatically created package does it work ?
Free Windows Admin Tool Kit Click here and download it now
November 28th, 2008 5:28pm

Hello Roman, Sorry for my late reply. Yes, this DOES work - manually adding a Script Component to a programmatically created package.
December 1st, 2008 4:27pm

Hi Robert, We don't currently support adding a script component programatically in a SSIS 2008 package. The reason behind it is that there is a tight link between the script and the metadata of the component that is very easy to break if done programatically. I don't know the problem you are trying to address by programatically inserting scripts in your pipeline task but two alternative solutions are: 1. create a custom component that might be easier to adapt you your problem (see http://www.microsoft.com/downloads/details.aspx?familyid=1c2a7dd2-3ec3-4641-9407-a5a337bea7d3&displaylang=enfor more information); 2. Have your script use a custom library thatyou can build and does the specific task. Hope this helps, Silviu Guea [MSFT] SQL Server Integration Services
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2008 9:36pm

Hi Silviu, Thanks for your information, it's very helpful. I'll try using the custom component as you described and hopefully it will fit into my scenario. Thanks,
December 10th, 2008 12:07pm

I ran into the same issue this morning. Somehow, it seems the metadata was messed up as Silviu described. My particular error was due to initializing a local variable in the ScriptMain class (outside the SubRoutine) to a variable I was passing into the Script Component.To resolve, I still declared the variable in ScriptMain but moved the initialization into the PreExecute() subroutine.Thanks,Travis
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2009 7:03pm

Silviu: THis thread is fairly dated, but hopefully you can still respond to another question...your reply/answer to Robert's question, alternative #2 was to use a "custom library". How is this different than building a "custom component" .. and are there any articles on building a custom "library" ? thanks.
March 19th, 2010 2:15am

This is not a problem with adding a dynamic script component. The problem just happened to me with a manually-added script component. The problem was that my script was using a System.Text.RegularExpressions.Regex instance to clean data. This was declared in a private field. The initialization was in the field declaration. This was the problem. Placing the initialization into PreExecute solved the problem. John Saunders WCF is Web Services. They are not two separate things. Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE Use File->New Project to create Web Service Projects
Free Windows Admin Tool Kit Click here and download it now
April 1st, 2011 11:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics