Archive

Archive for the ‘C#’ Category

Build automatically all projects in path

May 8th, 2009 No comments

For a long time i was searching a tool that it would build all my projects when i get latest version from sourcesafe/svn without opening solutions one-by-one so i create one to fit my needs. It’s very simple get-things-done program, the whole class goes like this

        private void addProjectsToList()        {
desProjectsFound.Items.Clear();
foreach (string strFileTypes in desProjectTypes.Items)            {                foreach (string item in Directory.GetFiles(                    desPathToProjects.Text,                     string.Format("*.{0}", strFileTypes),                    SearchOption.AllDirectories))                {                    desProjectsFound.Items.Add(item, false);                }            }            desProjectsFound.Sorted = true;        }

        public static string GetVSExeLocation()        {            return string.Format("{0}\\devenv.exe",                 ConfigurationManager.AppSettings["DevEnvLocation"]);        }

        private void btnBuild_Click(object sender, EventArgs e)        {            ExecuteAction(" /Build");        }

        private void btnRebuild_Click(object sender, EventArgs e)        {            ExecuteAction(" /Rebuild");        }

        private void ExecuteAction(string action)        {            for (int i = 0; i < desProjectsFound.Items.Count; i++)            {                if (desProjectsFound.GetItemChecked(i))                {                    Process.Start(GetVSExeLocation(),                         desProjectsFound.Items[i] + action);                }            }

        }

As you will see in download i use Krypton Toolkit


By the default options this thing will build automatically all projects in path.

Below is the compiled version of the program, don’t forget to modify the VS path in the config file to match the destination of your visual studio installation

 

ProjectBuilder.zip (697,82 kb)

Hope this helps someone besides me!

Categories: C#, Programming, Visual Studio Tags: