I have an application that starts and stops a specific service. However that service is named differently depending on what configuration I build the project in. In my WiX setup I have
<ServiceInstall
<!-- etc... -->
Name='$(var.ServiceName)'
DisplayName='$(var.ServiceDisplayName)' />
where var.ServiceName comes from an include file specified during the build process. I have to use the same service name in my C# code, but my problem with this approach is that the service names are written in two different places. How can I get the service name into one place?
Consider putting the service name into a registry key, where your C# code can easily access it. Since you install a service, your product is not copy-deployable anyway so using the registry could be an option.