Search code examples
version-controlssisscript-component

Version control for Script Component C# files in SSIS


I have this problem using version control with SSIS. When I am writing a Script Component it gets checked into the version control as binaries and not the C# file (it's understandable though). So next time I make a change in C# file of the Script Component, I am not able to see the difference in code.

Is there a way to get around this problem? What do you guys do about it?

Thanks, Vaibhav


Solution

  • All of the SSIS packages I currently work with (SSIS 2008) store Script Component code directly within the .dtsx file (these are just XML files). That said, you could use a text diff tool (Visual Studio Compare, WinMerge, BIDS Helper Smart Diff) to compare the .dtsx files. While that may not be the cleanest way to do it, it does allow you to see the difference between versions.

    Below is a snippet that I pulled directly from a .dtsx file with a Script Component (C# is stored as CDATA):

    <component id="4829" name="ExecuteQuery" componentClassID="{2E42D45B-F83C-400F-8D77-61DDE6A7DF29}" description="Executes a custom script." localeId="-1" usesDispositions="false" validateExternalMetadata="True" version="4" pipelineVersion="0" contactInfo="Executes a custom script.;Microsoft Corporation; Microsoft SqlServer v10; © 2007 Microsoft Corporation; All Rights Reserved; http://www.microsoft.com/sql/support;4">
    <properties>
    <property id="4833" name="SourceCode" dataType="System.String" state="cdata" isArray="true" description="Stores the source code of the component" typeConverter="" UITypeEditor="" containsID="false" expressionType="None"><arrayElements arrayElementCount="18"><arrayElement dataType="System.String"><![CDATA[\main.cs]]></arrayElement><arrayElement dataType="System.String"><![CDATA[/* Microsoft SQL Server Integration Services Script Component
    *  Write scripts using Microsoft Visual C# 2008.
    *  ScriptMain is the entry point class of the script.*/
    
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    using Teradata.Client.Provider;
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    {
        private TdConnection tdCn;
        private TdCommand tdCmd;
        private TdDataReader tdRdr;