/// <summary>
        /// Sets metadata version to assemblies current version
        /// </summary>
        /// <param name="component">pipeline component</param>
        /// <param name="componentMetaData">components metdadata</param>
        public static void UpdateVersion(PipelineComponent component, IDTSComponentMetaData100 componentMetaData)
        {
            DtsPipelineComponentAttribute componentAttr =
                (DtsPipelineComponentAttribute)Attribute.GetCustomAttribute(component.GetType(), typeof(DtsPipelineComponentAttribute), false);
            int binaryVersion = componentAttr.CurrentVersion;

            componentMetaData.Version = binaryVersion;
        }
示例#2
0
        /// <summary>
        /// Gets the Version of the Pipeline Component based ont he DTSPipelineComponentAttribute
        /// </summary>
        /// <param name="comp">Pipeline component to return the version</param>
        /// <returns>Version of the provided pipeline component</returns>
        public static int GetPipelineComponentVersion(PipelineComponent comp)
        {
            int version = 0;

            if (comp != null)
            {
                var attribs = TypeDescriptor.GetAttributes(comp.GetType());
                DtsPipelineComponentAttribute  pc = (DtsPipelineComponentAttribute)attribs[typeof(DtsPipelineComponentAttribute)];
                System.Reflection.PropertyInfo pi = pc.GetType().GetProperty("CurrentVersion");
                if (pi != null)
                {
                    version = (int)pi.GetValue(pc, null);
                }
            }
            return(version);
        }