Search code examples
c#visual-studio-2008setup-deployment

Two Setups For Same Project (visual studio 2008 , c#)


I have a Visual Studio project written in C#.

I want to have 2 different setups for different languages. For example, setup-en for step to be in English and setup-es for a Spanish installer.

I want the project to be built depending on the setup. Namely if I build setup-en I want it to check for in my project and build the project with English language for the user interface and same for Spanish.

Is there any way to manage this? Hope I was clear enough.


Solution

  • make a action-on-startup in your project, somethin like this:

    public void GetSettings()
        {
            string fileName = "./Names.xml";
    
            if (File.Exists(fileName))
            {
                XmlTextReader xml = new XmlTextReader(fileName);
    
                while (xml.Read())
                {
                    if (xml.Name.Equals("pgsql"))
                    {
                        try
                        {
                            button2.Text = xml.GetAttribute("button2");
                            button3.Text = xml.GetAttribute("button3");
                            button4.Text = xml.GetAttribute("button4");
                            button5.Text = xml.GetAttribute("button5");
                        }
                        catch (Exception)
                        {
                            throw new Exception("Settings: Failed to get all settings");
                        }
                    }
                }
            }
            else
            {
                throw new Exception("Settings: pgsql.xml not found!");
            }
        }
    

    this example is based on the file, Names.xml, which is included to the project. make some language folders and include the Names.xml file in these folders.

    for making a setup, use HM nis editor, found at http://hmne.sourceforge.net/. when running this program insert as filename setup-EN and choose all the DLL and .EXE files. Also include the English - Names.xml folder/map i hope this will work for you