Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am Trying to get the File Names of Content Added To Setup Via Custom Action.

I am able to access the Virtual Directory in which content files are going to copy,

but unable to list the files which will be copied.

So i am trying to display all the Files which will be copied to virual directory.

Please Help..
C#
using System;
using System.Configuration;
using System.Configuration.Install;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Collections.Specialized;

namespace CustomAction
{
    [RunInstaller(true)]
    public class SetupAction : Installer
    {
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);

            // Retrieve configuration settings
            string targetSite = Context.Parameters["targetsite"];
            string targetVDir = Context.Parameters["targetvdir"];
            string targetDirectory = Context.Parameters["targetdir"];


            //StringDictionary myStringDictionary = Context.Parameters;
            //if (Context.Parameters.Count > 0)
            //{
            //    foreach (string myString in Context.Parameters.Keys)
            //    {
            //        MessageBox.Show(Context.Parameters[myString]);
            //    }
            //}


            MessageBox.Show(Context.Parameters["targetdir"]);
            MessageBox.Show(Context.Parameters["newwebproperty1"]);//reading virtual directory //path


            System.Collections.IDictionary myStringDictionary = stateSaver;
            if (Context.Parameters.Count > 0)
            {
                foreach (string myString in myStringDictionary.Keys)
                {
                    MessageBox.Show(Context.Parameters[myString]);
                }
            }
        }

        public override void Commit(System.Collections.IDictionary savedState)
        {
            base.Commit(savedState);
            
        }
        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            base.Uninstall(savedState);
        }
        public override void Rollback(System.Collections.IDictionary savedState)
        {
            base.Rollback(savedState);
        }
        
    }
}
Posted
Updated 8-Feb-14 6:46am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900