Added auto-update for WindowsService and Service.

Needs some work otherwise the service will auto-update with a new sub-folder instead of autoupdate from the source folder.
This commit is contained in:
Kenneth Skovhede
2016-10-12 22:58:48 +02:00
parent 0f917bd8ff
commit ba94d36a80
3 changed files with 22 additions and 4 deletions
+8 -2
View File
@@ -19,9 +19,15 @@ using System;
namespace Duplicati.Service
{
class MainClass
public class Program
{
public static void Main(string[] args)
[STAThread]
public static int Main(string[] args)
{
return Duplicati.Library.AutoUpdater.UpdaterManager.RunFromMostRecent(typeof(Program).GetMethod("RealMain"), args, Duplicati.Library.AutoUpdater.AutoUpdateStrategy.Never);
}
public static void RealMain(string[] args)
{
using(var runner = new Runner(args))
runner.Wait();
+8 -2
View File
@@ -9,9 +9,15 @@ using System.Threading.Tasks;
namespace Duplicati.WindowsService
{
class Program
public class Program
{
public static void Main(string[] args)
[STAThread]
public static int Main(string[] args)
{
return Duplicati.Library.AutoUpdater.UpdaterManager.RunFromMostRecent(typeof(Program).GetMethod("RealMain"), args, Duplicati.Library.AutoUpdater.AutoUpdateStrategy.Never);
}
public static void RealMain(string[] args)
{
var install = args != null && args.Where(x => string.Equals("install", x, StringComparison.OrdinalIgnoreCase)).Any();
var uninstall = args != null && args.Where(x => string.Equals("uninstall", x, StringComparison.OrdinalIgnoreCase)).Any();
@@ -73,6 +73,12 @@
<None Include="App.config" />
<None Include="Duplicati.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Library\AutoUpdater\Duplicati.Library.AutoUpdater.csproj">
<Project>{7E119745-1F62-43F0-936C-F312A1912C0B}</Project>
<Name>Duplicati.Library.AutoUpdater</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.