title: What is the best way of automating Windows Service deployment?
body: <p>I have created a windows service using C# in Visual Studio 2010. I did a lot of research about automating the installation process. Got lots of advice but none did work for me. The windows service i have created has lots of dependencies and i would like client to have no UI interaction during the installation. I have created a setup project for this which includes all my dependencies within the installer. </p>
  
  <p>Process involved:</p>
  
  <ul>
  <li>Create a build for windows service</li>
  <li>Push the setup file (.msi) to remote location</li>
  <li>Call the .msi and install the service silently without user interaction.</li>
  </ul>
  
  <p>What i did so far:</p>
  
  <ul>
  <li>Created a powershell script to push files to remote location</li>
  <li>Execute powershell script and install the service</li>
  </ul>
  
  <p>Please keep in mind that powershell script </p>
  
  <pre><code>sc create "servicename" binpath="somepath"
  </code></pre>
  
  <p>is used for installing service from a project directory not for installing .msi file created using Setup Project these are two vast different things. If you don't understand this don't answer please.</p>
  
  <p>Possible solutions:</p>
  
  <ul>
  <li>Use (<a href="http://www.msbuildextensionpack.com/help/4.0.5.0/html/258a18b7-2cf7-330b-e6fe-8bc45db381b9.htm">http://www.msbuildextensionpack.com/help/4.0.5.0/html/258a18b7-2cf7-330b-e6fe-8bc45db381b9.htm</a>) msbuild extension pack.</li>
  <li>Use buildarguments to call msbuild extension pack to install windows service. </li>
  <li>Use (<a href="http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx">http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx</a>) Exec Task</li>
  <li>Use WIX(Windows Installer Xml)</li>
  </ul>
  
  <p>Now my question is. How can i push windows service installer to remote location? And how can create custom build arguments and use either msbuild extension pack or Exec Task and install the service?</p>
  
  <p>I know this sounds stupid and irritating question for someone who hasn't installed the service using (.MSI) created by the Setup Project. But its my requirements which i am trying to solve since weeks in the enterprise environment.</p>