Take the 2-minute tour ×

we have an existing MQ custom connection manager that's currently being used by several existing SSIS packages.

I want to add a new property and modify the code a little bit, but if I do that, it looks like I am breaking everything else (have to redo all of them.)

Is there a way where I can get around this without disrupting the existing packages that use it?


share|improve this question
add comment

1 Answer

Assuming that your you need to edit the SSIS package by adding the property and RUN it. After that you dont need the SSIS package. Following code method should be added to your application and call this method. So all the changes will be applied only to the new package without modifying another package.

  1. Get the SSIS package
  2. Create the copy of it by appending the GUID. so your package name is like PackageName_GUID.dtsx
  3. Add your property.
  4. RUN your SSIS package
  5. OnSuccess full execution. Delete the SSIS package.


    public static DtsErrors RunSSISPackage(string packagePath, string MQProperty)
             * Append the auto generated GUID with the package name for running the SSIS package
            string uniqueId = Guid.NewGuid().ToString();

            string uniquePackage = Path.GetDirectoryName(packagePath) + @"\" + Path.GetFileNameWithoutExtension(packagePath) + "_" + uniqueId + ".dtsx";

            File.Copy(packagePath, uniquePackage);

            Package pkg;
            Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

            pkg = app.LoadPackage(uniquePackage, null);


            pkg.Connections["MQConnection"].<<YourPropertyName>> = MQProperty;

            //Uncomment this to overwrite the existing file
            //Do nothing until you are using a version control system
            //app.SaveToXml(packagePath, package, null);

            DTSExecResult result = pkg.Execute();

            if (result == DTSExecResult.Failure)
                return pkg.Errors;


        return null;

Hope this helps!

share|improve this answer
I don't want to delete the package though, I want to keep it. I am trying to update the custom code for that connection manager. My new property is a bool so by default it already has a value which means existing packages that use this connManager shouldn't be affected but that's not the case, unfortunately. I want it so existing packages are okay and new packages can utilize this new property. –  muddy May 27 '13 at 23:37
In that case, the code from Package pkg to the commented line of app.SaveToXml will modify an existing package in place. If the data type is boolean, then all you need to do is change it in the method parameter from string to bool and the assignment remains the same. –  billinkc May 28 '13 at 2:21
add comment

Your Answer


