Include files marked as "Copy to Output Directory" with Installshield LE
Asked Answered
V

1

36

I'm building a Windows Service in VB.NET with Visual Studio 2012. I included log4net in my project to deal with logging information about the service execution. I created a log4net.config file, which I marked Copy if newer in its Copy to Output Directory property.

I added an Installshield LE Setup project to my solution, and selected Myproject.Primary Output in the files to include. I expected my log4net.config file to be included in the setup since it's marked to be copied in output, but when I actually install it, it is not included. I already did research and found that I can turn the Build Action to Content for log4net.config and then also include Myproject.Content Files in my Setup Project. It turns out it works.

However, after reading this answer on SO, I noticed that Build Action->Content is used to get files as streams, which is not really what I wanted to achieve with it

I would like to know if there is an other way, a recommended way to include my log4net.config file from the build into my Installshield Setup project ?

Violoncellist answered 18/7, 2013 at 12:42 Comment(1)
It seems to me that what you found is the way to go, even though you don't actually use the "stream" stuff. Otherwise, as far as I know, you have to manually add the file to the setup project through "2 - specify application data / Files"Expellant
A
1

How about adding loggly related configuration in App.config file like below. I am using it for hosting WCF service within Window Service and it works fine for me.

   <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>

      <log4net>
        <root>
          <level value="ALL" />
          <appender-ref ref="LogglyAppender" />
        </root>
        <appender name="LogglyAppender" type="log4net.loggly.LogglyAppender, log4net-loggly">
          <rootUrl value="https://logs-01.loggly.com/" />
          <inputKey value="abcdefgh" />
          <tag value="log4net" />
        </appender>
      </log4net>
Aporia answered 14/12, 2018 at 17:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.