Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 561
MaxiWheat Avatar asked Jul 18 '13 12:07

MaxiWheat


1 Answers

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>
like image 166
Kamal Desai Avatar answered Nov 11 '22 18:11

Kamal Desai