Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Problem loading SSIS project parameters out of Project.params file

$
0
0

Hi,

I'm trying to load and validate dtsx packages in an C# application, which are created in an SSIS project of SSDT in Visual Studio 2010. Therefore I'm using theMicrosoft.SqlServer.ManagedDTS.dll assembly version 11.0.0.0. First I'm loading the packages (dtsx files). Then I'm loading the connnection manager files (conmgr files). At least I'm trying to load the project parameters in the Project.params. For this (and for the other loading procedure) I'm using the LoadFromXml methods. In this case the LoadFromXml method of Microsoft.SqlServer.Dts.Runtime.Parameter. My code looks like this:

                // load file Project.params
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(File.ReadAllText(paramFileName));

                // namespace is necessary
                XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
                ns.AddNamespace("SSIS", "www.microsoft.com/SqlServer/SSIS");

                // extract all ssis project parameters
                XmlNodeList list = doc.SelectNodes("/SSIS:Parameters/SSIS:Parameter", ns);
                foreach (XmlNode node in list)
                {
                    // initialize a new parameter with defaults
                    Parameter param = package.Parameters.Add("DEFAULT", TypeCode.Boolean);

                    // set parameter values out of xml node
                    param.LoadFromXML(node, null);  // <- a DtsRuntimeException is thrown with HRESULT: 0xC0011001 
                }

The DtsRuntimeException is thrown because Project.params file defines other namespace(www.microsoft.com/SqlServer/SSIS) with SSIS:Parameter inclusive other syntax instead of (for test purpose) param.SaveToXML(...) which creates XML content of namespacewww.microsoft.com/SqlServer/Dts and DTS:PackageParameter.

My question is, how can I load all project parameters out of Project.params file in an C# application so I can use it in Microsoft.SqlServer.Dts.Runtime.Package objects for validation (inclusive sensitive parameter with encryption)? Exist another method (in other assembly) for loading project parameters? Exist other way for satisfy my needs?

Regards, Thomas


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>