Windows Service config deployment RRS feed

  • Question

  • User-1548088970 posted

    I had a question about deploying a windows service with multiple configuration files. I have created a windows service and a setup project which uses the Primary Output of the Windows Service project. I have an app.config and other config files that are referenced within the app.config. How do I include those other config files as part of the setup project? The problem is that I am trying to change the configuration based on the Configuration Property (Staging, Release, etc) and the IDE doesn't pick up file written in the bin directory. It references the App.config in the source directory. I'm certain others have ran into this.

    Web deployment projects is able to do this, but it stands as a middle man with custom output which is piped to the setup project. Am I going to have to do the same?

    Friday, September 26, 2008 4:04 PM

All replies

  • User-1548088970 posted

    After further research, I have discovered that the Primary Output is pulling from the obj directory and not the bin directory for the exe and the project root directory for the configuration. So, how are you supposed to change configurations on the fly when it pulls from the source directory and not the output directory?

    Friday, September 26, 2008 5:03 PM
  • User411632289 posted

    I am facing the same problem. How did you fixed the problem of updating config location instead of picking from source directory app.config

    Friday, July 8, 2011 4:21 PM
  • User-952121411 posted

    Are you by chance trying to read configuration data in an App.Config of a class library that is referenced by the Windows Service? If 'Yes' is the answer it will not work. When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. What this means is any pertinent .config information from any .config file not in the host project, must be copied into the host's project .config file to be read at runtime. There are manual ways around reading a deployed class libraries own .config file but it is a mess and I do not recommend it.

    As far as the obj/bin issue, sounds like the project's build properties may have gotten messed up. To look at them right-click the project in VS.NET's 'Solution Explorer' and select 'Properties'.  Click on the compile tab. The default build path is to "bin\"

    Monday, July 11, 2011 4:41 PM