1

I have created a Windows Service that reads various paths from the app.config file and works correspondingly.

I also use the 'Visual Studio Installer' as a installer for my Service.

This is my project structure:

enter image description here

However, when I build the Installer, it does generate the .msi and .exe used to install my service, but it doesn't include the config file that it needs to use to fetch the paths it's using:

enter image description here

Normally, the only thing that I use is the .msi file to install and run the Windows Service (it works perfectly using hardcoded paths) but I can't seem to use it in combination with the config-file.

What I tried is to copy the config file from the service project, and paste it in the folder of the second screenshot, but the service doesn't work when I try to install and run it that way.

What am I doing wrong?

EDIT

I tried adding the .config file manually in the installer project:

enter image description here

Without success however

4
  • check these links, stackoverflow.com/questions/26515084/… stackoverflow.com/questions/14074563/… Commented Mar 28, 2017 at 8:26
  • Check this, maybe you need to add config to projects output youtube.com/watch?v=cp2aFNtcZfk Commented Mar 28, 2017 at 8:26
  • Thanks Daniel, I tried to add the .config file in the project output folder, it actually puts the config file in the files folder but it doesn't use it I think Commented Mar 28, 2017 at 8:42
  • Can the person who downvoted the question please motivate the reason? Commented Mar 28, 2017 at 9:11

1 Answer 1

2

Nothing.

App.config is a part of the Service project and NOT of the installer.

It will be in the target installation folder of your Service assembly after installing.

Also App.config will be renamed according to the project's assembly name.

Example

Your assembly name is Watcher.Service, your .exe will be, after compiling Watcher.Service.exe and your app.config now will have the name Watcher.Service.exe.config.

Sign up to request clarification or add additional context in comments.

6 Comments

I think it has to do with the fact that I have 2 seperate projects (1 is the service, the other is the installer)? I'm not sure however but it's not working if I manually copy-paste the config file to the installer project
I also added the ServiceName.exe.config file to the folder after but it also didn't work
You shouldn't add the *.config file manually. This is a misunderstanding of the behavior.
but if I don't, the .conf file won't show up (not even hidden) in the program folder of the service. SHouldn't there be a link between the two projects in one way or another?
The program folder of the service is not the folder Debug/Release folder?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.