Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conflicting assembly names after copying script components in SSIS

I created an SSIS package (in VS 2013) with a data flow task containing several script components. I needed to add another data flow task that is similar to the existing one so I copied and pasted it into the package and added a precedence constraint so that the new one runs after the old one. I changed the code in the script components in the new data flow task according to business requirements and ran the package. I soon realized that when the new data flow task runs, the script components from the old data flow were being executed. Weird.

After some internet searching, I found this page:

http://kohera.be/blog/sql-server/the-dangers-of-copying-script-components-in-ssis/

which describes how the copying of the data flow task doesn't change the assembly name or root namespace in any script component in the new data flow. Apparently, at runtime the assembly of the new script is overwritten by that of the old script. The web page says the problem can be fixed by copying the script component to another package and then copying it back to the original package. Presumably that will change the assembly name of each script component. I'm glad it worked for him but it didn't work for me.

I also tried changing the assembly name in the script editor here:

Application properties

But that didn't work either. The code in the old script component still runs in the new data flow. I'm guessing the root namespace needs to change but that's greyed out so I can't manually change it. So I'm still looking for a solution that doesn't involve recreating the script components from scratch since they contain multiple outputs with many columns in each. Hoping you might have an answer.

like image 868
user2148983 Avatar asked Jul 08 '16 20:07

user2148983


People also ask

How do I copy a SSIS project?

In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package that you want to copy. In Solution Explorer, double-click the package. On the File menu, click Save <package name> As. The package must be opened in SSIS Designer before the Save As option appears on the File menu.


1 Answers

I have been curious about your question because I have had this happen to me in the past and I corrected by simply recreating the script component and copying relevant code. Obviously less than idea but.....

anyway, I confirmed by looking at the dtsx package in notepad (note it is just xml) that the issue with copying is the application/namespace remains the same so when compiled one just overwrites the other.

I found a good blog on a way to do it in a Sript Task (http://agilebi.com/jwelch/2008/04/30/renaming-the-script-project-in-ssis-2008/) but the same solution doesn't look like it is available in a Script Component because the later does not have expressions available to it for use.....

Script Component Method - Successfully Tested

However, I did just recreated the problem and discovered a solution. Thought admittedly I am not sure if my solution would be easier than recreating the script component and copying in the script. Anyway, a DTSX is an XML file so you can edit it directly! In my case and likely standard there was 10 locations that I had to change the values. So

  • find the value of the namespace/assembly name (several places I will let you figure out where you want to get it from).
  • Then change the file extension on your package to XML and open in an XML editor such as visual studio
  • Do a find all to find all of the locations the assembly name appears, remember it will be twice the amount you need to change because both components are using the same name.
  • When navigating the results just a few lines above the first result will be a name identifying which component and data flow you are in.
  • step through the results until you find the component you want to change, again in my case that was the 11th result. Then change all the values between that result and the end of the search or until you find you are in another data flow/component.
  • rename the file back to .dtsx and you are done.

Create a backup copy of your package just in case!

Script Task Method - Successfully Tested

And the easy method if you are discussing a Script task in the Control Flow.

  • go to properties of Script task and choose Expressions
  • The input a new value in the property of ScriptProjectName
  • confirm your change has taken place by choosing edit to edit the script.

enter image description here

like image 92
Matt Avatar answered Oct 05 '22 07:10

Matt