help needed for setup project with configuration files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • softgelsin
    New Member
    • Sep 2007
    • 7

    help needed for setup project with configuration files

    hey all,

    i have a console application written in c# which reads input and output file locations from a config file, app.config. i am trying to build a setup installer for that application. I couldnt find how to include that config file in the deployment.
    I want to use the setup project method.

    Is there anyone know how i need to include the configuration file to the installer.

    Greatly appreciated...

    softgelsin
  • naivE
    New Member
    • Jun 2007
    • 12

    #2
    Hey.

    Just add the config file into the Application folder in the installer.

    Comment

    • softgelsin
      New Member
      • Sep 2007
      • 7

      #3
      I added but then when i install the program in a different machine, it gives a unhandled error. and dont think it reads from the config file.

      Originally posted by naivE
      Hey.

      Just add the config file into the Application folder in the installer.

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Have you hardcoded the path of app.config?

        Comment

        • naivE
          New Member
          • Jun 2007
          • 12

          #5
          Originally posted by Shashi Sadasivan
          Have you hardcoded the path of app.config?
          Sorry, I should have said that. Shashi is right. You are going to need to change your path(s) to a relative one. ..\Config.txt or something. Actually, use
          Code:
          Application.StartupPath + @"\config.txt"
          The just make sure that your config file is in the same folder as your exe.

          Comment

          • softgelsin
            New Member
            • Sep 2007
            • 7

            #6
            thx for your help but no i didnt hard code it. I am using system.configur ation library which includes built-in features so that i dont have to hard code. It knows it needs to look at the app.config file when i say string sLoc = configuration.A ppsettings["fieldname"] ;

            any more ideas?

            Comment

            • Shashi Sadasivan
              Recognized Expert Top Contributor
              • Aug 2007
              • 1435

              #7
              Originally posted by softgelsin
              thx for your help but no i didnt hard code it. I am using system.configur ation library which includes built-in features so that i dont have to hard code. It knows it needs to look at the app.config file when i say string sLoc = configuration.A ppsettings["fieldname"] ;

              any more ideas?
              use the system.configur ation library to get the path of the app.config...
              maybe it cant find it there!

              Comment

              • softgelsin
                New Member
                • Sep 2007
                • 7

                #8
                but why i need the location of the config file. I am already able to read the config file when i ran the program in visual studio. The problem is when i create a setup project, and install it somewhere else.

                what i expecting was when i include the project to the setup project, i also include the config. So i thought it should know it is going to use and create that config file too. It creates but looks like it doesnt use it.

                Originally posted by Shashi Sadasivan
                use the system.configur ation library to get the path of the app.config...
                maybe it cant find it there!

                Comment

                • Shashi Sadasivan
                  Recognized Expert Top Contributor
                  • Aug 2007
                  • 1435

                  #9
                  Well..havent worked much with installation packages, especially console based ones. Can you however describe the unhandeled error?? have you got a log of it?
                  Originally posted by softgelsin
                  but why i need the location of the config file. I am already able to read the config file when i ran the program in visual studio. The problem is when i create a setup project, and install it somewhere else.

                  what i expecting was when i include the project to the setup project, i also include the config. So i thought it should know it is going to use and create that config file too. It creates but looks like it doesnt use it.

                  Comment

                  • softgelsin
                    New Member
                    • Sep 2007
                    • 7

                    #10
                    unfortunately. it closes itself immediately

                    Originally posted by Shashi Sadasivan
                    Well..havent worked much with installation packages, especially console based ones. Can you however describe the unhandeled error?? have you got a log of it?

                    Comment

                    • softgelsin
                      New Member
                      • Sep 2007
                      • 7

                      #11
                      Also when i am adding the configuration file which one i am adding? there are two of them. One in the main folder named "App.config ", the other one is in the bin/debug folder with the application name "appName.exe.co nfig".

                      Comment

                      • softgelsin
                        New Member
                        • Sep 2007
                        • 7

                        #12
                        I decided to go with xcopy instead of creating a msi package. I am going to install it only on one machine anyways.

                        Thx all.

                        Comment

                        • keren
                          New Member
                          • Feb 2012
                          • 1

                          #13
                          Did you try:
                          go to the app.config in the original project ( not setup)
                          In its properties: Copy To output directory =Copy always
                          I think this should work
                          best
                          Keren

                          Comment

                          Working...