Coder Social home page Coder Social logo

dbforge / nupdate Goto Github PK

View Code? Open in Web Editor NEW
447.0 39.0 72.0 12.27 MB

A comfortable update solution for .NET-applications.

Home Page: https://www.nupdate.net

License: MIT License

C# 97.10% Smalltalk 1.18% PHP 0.13% HTML 1.59%
updater update update-service signing-keys microsoft rsa security dotnet c-sharp operation

nupdate's Introduction

nUpdate Logo

nUpdate - .NET Update Solution

Release GitHub license Donate

nUpdate is a powerful update system for .NET applications. Providing high security and an easy-to-use user interface, it is the perfect solution for your software.

Features

  • Remote update package control and management
  • Many configuration settings
  • Operations let you access the file system, the registry and add the possiblity to start or stop processes and services, when installing an update. You can even execute a small C#-script.
  • Automated updating for all clients
  • Secured update packages by signing with SHA512 and 8192 Bit RSA-keys
  • Built-in user interface or a custom user interface can be used
  • Interfaces, service providers and the Event-based/Task-based asynchronous pattern add a lot of flexiblity
  • Smart statistics about the downloads of your published updates
  • Supports very large update packages
  • ...

Specs and requirements

The pure nUpdate library is based on .NET standard 2.0. This means your project needs to fulfill one of these requirements:

  • .NET Framework >= 4.6.1
  • .NET Core >= 2.0
  • UWP >= 10.0.16299

All other libraries in the solution use the .NET Framework 4.6.1.

Installation

You can get the necessary libraries and applications from the current releases. The nUpdate library itself can also be installed in your application using the NuGet package manager.

Using NuGet

PM> Install-Package nUpdate -Version 4.0.0

Usage example

Simple integration

Specify the current client version inside Properties > AssemblyInfo.cs

[assembly: nUpdateVersion("1.0.0.0")]

or inside the constructor of the UpdateManager class (is null by default):

var manager = new UpdateManager(
    new Uri(...), "PublicKey", CultureInfo.Foo, new UpdateVersion("1.0.0.0"));

Note: One of the both needs to be specified. If both are specified, the version specified in the constructor parameter will be used. When none of them is specified, an exception will be thrown.

Using the integrated user interface (Windows Forms or WPF)

The package nUpdate.UI.WindowsForms provides a built-in user interface for Windows Forms application. Install it via NuGet:

PM> Install-Package nUpdate.UI.WindowsForms -Version 1.0.0

To use the built-in WPF user interface, you need to install nUpdate.UI.WPF:

PM> Install-Package nUpdate.UI.WPF -Version 1.0.0

Both projects give you an UpdaterUI class that you can use as follows:

// Generated via nUpdate Administration > Open project > Overview > Copy source
var manager = new UpdateManager(
    new Uri(...), ...);

var updaterUI = new UpdaterUI(manager, SynchronizationContext.Current);
updaterUI.ShowUserInterface();

Using no user interface (synchronously)

// Generated via nUpdate Administration > Open project > Overview > Copy source
var manager = new UpdateManager(
    new Uri(...), ...);
    
if (manager.SearchForUpdates())
{
    manager.DownloadPackages();
    if (manager.ValidatePackages())
        manager.InstallPackage();
    return;
}

Using no user interface (asynchronously)

For asynchronous usage, each method (except InstallPackage and ValidatePackages which are synchronous in any case till now) has a corresponding asynchronous one defined inside the UpdateManager.

Specifying an UpdateVersion

nUpdate uses a custom version implementation to describe application versions. Semantic versioning is not fully supported among the exact specification but an implementation for it is already included in v4.

You may specify versions as known with the ordinary parts Major.Minor.Revision.Build, e.g. new UpdateVersion("1.2.0.0"). Pre-Releases may be noted by appending the leading, lowered letters of developmental stages and a development build. For example, 1.2 Beta 1 is noted as 1.2.0.0b1 or 1.2b1, 1.3.1 Alpha 3 is noted as 1.3.1.0a3 or 1.3.1a3. This means that trailing zero subversions may be ignored and have no need to be declared. The last subversion and the developmental stage may be separated by a dash: 1.2-a1.

There are three developmental stages to this point:

Alpha: a, Beta: b, ReleaseCandidate: rc

Note: These need to be specified by using the abbrevations above. 1.2.3alpha1 is not valid in v3 of nUpdate.

In version 4 any type of pre-release descriptor, as well as build metadata, will be available. It will fulfill the complete semantic versioning specification and have an abstract version system.

Supported by

nupdate's People

Contributors

alivedevil avatar nofear23m avatar selway avatar stefan-baumann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nupdate's Issues

manager.PackagesDownloadStarted not fired

Hey guys,

Maybe i'm just not good enough with C#, but for me it seems that the event manager.PackagesDownloadStarded is not fired.

My Code:

using nUpdate.Updating;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Windows;

namespace KLauncher____Installer {
 /// <summary>
 /// Interaktionslogik für MainWindow.xaml
 /// </summary>
 public partial class MainWindow: Window {
  public MainWindow() {
   InitializeComponent();
  }

  private void button_Click(object sender, RoutedEventArgs e) {
   UpdateManager manager = new UpdateManager(new Uri("ServerURL"), "Key provide by nUpdate Administration", new CultureInfo("de-DE"));
   manager.PackagesDownloadStarted += Manager_PackagesDownloadStarted;
   var updaterUI = new UpdaterUI(manager, SynchronizationContext.Current);
   updaterUI.ShowUserInterface();
   manager.RestartHostApplication = false;

  }
  public void Manager_PackagesDownloadStarted(object sender, EventArgs e) {
   MessageBox.Show("Event fired!");
  }
 }
}

Please tell what i'm doing wrong:)

Have nice easter days.

Error uploading new configuration file

Hello, I've created an FTP-server running on IIS and I have a full access. On uploading new configuration file I'm getting this strange error (nUpdate Administration v3.3.1).
error

Storing Path in nUpdate-Project

After migrating my useraccount to "C:\Users\AliveDevil" and moving "nUpdate Administration" to "nUpdate.Administration" nUpdate throws a filenotfoundexception.
Cause: Every path is saved in the project file.

How does clients/users get the update?

Very simple and basic question that I do not see attended to anywhere. The wikis, github issues, information on the official website, etc... all explain and discuss the administration end.

How is nUpdate implemented on the client side, such that when we done updating and setting things up at the admin side, client/users of my app will have their nUpdate downloading as intended?

Thanks

Event for cancel

How can i make it exit application when they click cancel.
I dont want users to be able to carry on if they dont update.
Thanks

Missing Files

Following files are missing in the repository but are referenced in project files.
nUpdate:
Core\Operations\OperationsMethods.cs
Core\SizeConverter.cs
UI\Dialogs\BaseForm.cs
UI\Dialogs\BaseForm.resx

nUpdate Administration:
Core\Application\Sql.cs
Core\Update\Operations\OperationMethods.cs
Core\Update\Operations\Panels\RegistryEntryCreateOperationPanel.cs
Core\Update\Operations\Panels\RegistryEntryDeleteOperationPanel.cs
Core\Update\Operations\Panels\RegistryEntrySetValueOperationPanel.cs
UI\Controls\WatermarkTextBox.cs

nUpdate UpdateInstaller:
Controls\ControlPanel.cs
Core\Operations\OperationMethods.cs
Dialogs\MainForm.cs

Invalid assembly found

When trying to use "Load version from assembly" in nUpdate Administration 3.2.0, I get an error:

Invalid assembly found.

Could not load file or assembly 'nUpdate.WithoutTap,
Version=3.2.0.0, Culture=neutral, PublicKeyToken=null' or one
of its dependencies. The system cannot find the file specified.

I have updated the nuGet package in my application to 3.2, but it just won't load the assembly.

Architecture selection results in the wrong architecture

When creating a package and selecting another architecture than AnyCPU, nUpdate will check the client's system for the wrong architecture (x64 instead of x86 and vice-versa) before making the package available which result in a missing package. This is caused by a UI mistake.

Specifying a non-existent culture is not handled

There is no exception thrown or alternative culture used in this case. Instead, nUpdate seems to work fine until the download of the update packages has finished. After that, it just closes the dialog, throwing a NullReferenceException internally when trying to access the localized properties that do not exist.
This should be fixed.

Is there any documentation for this at all?

Hello,

Is there any documentation for this project at all? It looks nice from the screenshots but I can't find anything in the Wiki and the docs section on the Website is simply a listing of the types and namespaces.

Thank you!

Working on different Computers

Hello,

I'm currently working on the same project from different computers with Git.
As the whole project, I also copy the update.nupdproj with Git, and this seems to be a problem.
A path string is stored inside the update.nupdproj, and because i'm sometimes on another computer, it cannot find this local path.
It's not a big problem, i just edited the update.nupdproj myself, so it fits the path, but I think you could improve there a little bit.


Nochmals in Deutsch, da mein Englisch nicht das Beste ist.

Ich arbeite momentan an einem Projekt mit mehreren Arbeitsplätzen, wobei mit Git gearbeitet wird, um immer die aktuellste Version auf jedem Rechner zu haben (des Sources).
Nun hatte ich damals auf Rechner 1 das nUpdate Projekt erstellt und die update.nupdproj Datei einfach auch mit Git synchronisiert, damit ich Updates auch vom zweiten Rechner aus hochladen kann.
Leider scheint dies nicht so einfach zu gehen.
Ich habe herausgefunden, dass in der update.nupdproj ein lokaler Pfad als String gespeichert ist (der Datei-eigene Pfad) der natürlich auf einem anderen Rechner nicht mehr unbedingt stimmt.
Ich konnte das Problem umgehen, in dem ich die Datei mit einem Texteditor geöffnet und von Hand den Pfad geändert habe, so dass es danach stimmte.
Dennoch denke ich, dass man hier eventuell etwas ändern könnte, auch wenn es nicht direkt notwendig ist.

Greetings KillTrot

Host applications are not always closed

The host application is not always closed correctly, if it's a WPF or console application (or else the closing of a form is cancelled). This is due to the functionality of Application.Exit and should be changed.

Managing updates for other applications

Hey there,

i'm currently writing something like a launcher for my other software and i want to update them with my launcher.
Therefor the actual Version cannot be the same, as the one of the launcher (which is also updated with nUpdate).
Is there a possibility to set different "assembly: nUpdateVersion"?
For example read the actual version out of a text file or something?

Greetings

Can't use "Operations" on package

When attempting to use any of the Operations on a new or existing package, clicking on one of the options does nothing.
image
However, Add/Replace works just fine.
Am I doing something wrong, just being dumb?

Feature Request: Install as Admin

Hello!

Could you add a property that allow to disable starting the installer as admin, please?
Currently I inject a property into your dll using dnSpy.

And I use it like that:
grafik

Thanks!

Connecting via FTP

I always get the error

Field must contain equals "-" value with only a name and value

Mono Linux supported?

Has anyone tested this library on mono framework using a Linux OS (example CentOS)?

Conflict between mscorlib 4.0.0.0 and 2.0.5.0 when using nuget package nUpdate.ProvideTAB

Hello,

When I built my project where the nuget package nUpdate.ProvideTAB is installed (targeting.Net Framework 4.5), I always get this line in the built output:
Der Konflikt zwischen "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" und "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" kann nicht aufgelöst werden. Auswahl von "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" nach dem Zufallsprinzip.

It says, there is an conflict between mscorlib v4.0.0.0 and v2.0.5.0 and it takes v4.0.0.0 always but after ~5 seconds delay.

Can you check it out please? It's annoying.

And it's not specific for the last update, because this problem I have since I've installed nUpdate.ProvideTAB.

If you need more informations, tell me.

Thank you very much!

Pilzinsel64

How to rename or delete files?

How do I add an action to delete/rename a file or any other action? I can only add files to directories.

And is there any blog/forum about this Updater I can check?

ProjectEdit throw an "InvalidOperationException"

Version: 3.2.1
ProjectEditDialog.cs
image
image
The exception message means "Cross-thread operation not valid: Control ‘ProjectEditDialog’ accessed from a thread other than the thread it was created on".

Change Update Location

After my user account migration I tried to open a single project. Everything is OK except: I cannot see ANY Update because every update is saved in %AppData%.
I would like you to change that behaviour:
Either let the user specify where to store update files, make ovious where update files are stored or use a more intuitive path (i.e. in the project file directory under updates).

App restarted as admin?

Hello and sorry for asking questions again:P

In my software i use an app.manifest to force the program using admin rights (requestedExecutionLevel level="requireAdministrator")

Now my question; Does nUpdate restart the host program (my software) with admin rights, after an update?

Greetings
Cedric

Some suggestions for nUpdate.Administration

  1. The 'Tabindex' of the input element in 'NewProjectDialog' is not ordered.
  2. Setting the default file name of the Save Project dialog to project name that user entered might be better.
  3. I think that when a new project is built, the user might want to open it directly.

Error while updating the Application

Hello,

I have problem with updating application. After I ran manager.InstallPackage(); installation progress is shown, but in a while I got error
image

I have tried everything to get rid of this error, nothing helps.

Could you please guilde me what am I doing wrong?

PS. This is how I'm doing it right now (not working OFC)

Task.Factory.StartNew(async () =>
        {
            await Task.Delay(TimeSpan.FromSeconds(10));
            UpdateManager manager = new UpdateManager(...)
            var forUpdates = manager.SearchForUpdates();
            if (forUpdates)
            {
                manager.DownloadPackages();
                manager.CloseHostApplication = true;
                manager.InstallPackage();
            }
        });

Add package files only when they're already existing

Hi. I have a question about nUpdate. Does it support updates if a certain extension folder is present?

For example: I have an application that supports extensions (like Google Chrome). If an extension were installed in the following directory: myapp/extensions/coolExtension, nUpdate will continually update this extension to the latest version, when available. However, if the extension was not installed (is not present in my application's extension folder) nUpdate will not show/allow updates for this extension (i.e. it will ultimately ignore updates for that particular extension and simply provide updates for other installed extensions or the application itself).

Is this possible?

Add feature to create a package based on an existing one

Since it often happens that the packages are similar (ie almost the same actions must be performed) would be a way to copy a package well.

Example: A button "Add copie" in the package administration which adds a package with the same actions and files but this package will not be saved but will just open as a dialog. Now you make only minor adjustments and saves the package.

Proxy authentication

Hello!

It would be brilliant if I could setup an proxy authentification in the Settings.

Per code you can setup like this:
System.Net.WebRequest.DefaultWebProxy.Credentials = New System.Net.NetworkCredential("Username", "Password");
And the authentification will be used for the whole application.

And in the Settings like this:
grafik

Thanks

Https error (Forbidden 403) in some plesk hoting areas

Hello sirs and thank you for your great work,
I'm using your application since almost a year, but had to move the update files to another hosting area, in that area I kept getting "Forbidden 403-Access denied" error despite that the directory listing is working and Json file is accessible from the browser.

That took me three days until I accidentally found someone talking about the "user-agent" header (see this link : https://stackoverflow.com/a/2794346 ), so I decided to clone your code and debug it my self.

then I changed couple places:
1- file: "nUpdate.Shared\Updating\UpdateConfiguration.cs"
Method :
public static IEnumerable Download(Uri configFileUri, NetworkCredential credentials, WebProxy proxy, int timeout = 10000)

Changed this code:

wc.Encoding = Encoding.UTF8;
if (credentials != null)
    wc.Credentials = credentials; 
if (proxy != null)
    wc.Proxy = proxy;

to this:

wc.Encoding = Encoding.UTF8;
if (credentials != null)
    wc.Credentials = credentials;
wc.Headers.Add("user-agent", "Only a test!");
if (proxy != null)
    wc.Proxy = proxy;

2- file "nUpdate.ProvideTAP\Updating\UpdateConfiguration.cs",
Method:
public static async Task<IEnumerable> DownloadAsync(Uri configFileUri, NetworkCredential credentials, WebProxy proxy, CancellationTokenSource cancellationTokenSource = null, int timeout = 10000)
change this code:

// Check for SSL and ignore it
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; 
var request = (HttpWebRequest)WebRequest.Create(configFileUri); 
request.Timeout = timeout;

To this:

// Check for SSL and ignore it
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };

var request = (HttpWebRequest)WebRequest.Create(configFileUri);
            
request.UserAgent = "Only a test!";
request.Timeout = timeout;

then the issue is gone from the administration application..

So I suggest that you add an option to specify the request headers and also allow the user to specify custom client for the request and setting a default "user-agent" header for the administration and all parts of the application.

The version I'm using is v3.5.0

Thank you for your effort

Operations before the "Replace file/folder" module

Hi again,

I was wondering if it is possible to have an operation placed before the "Replace file/folder" operation.
For instance so I could stop a running Windows Service, replace the necessary files and restart it once completed?

I have tried CTRL+Up to push it above but this doesn't appear to be possible.

Enhancement - dotnet core/standard/472

Hello,
do you agree to update the library to .dotnetcore 2.2, .net standard 2.0 and .net framework 4.7.2 ?
Also I realized a new provider, nUpdate.WebProvider, to be used in asp net.

I did some little changes to your library, so it can be used in Linux too.
I prefer to pull a request, in order to avoid creating a new nuget package.
Let me know

Option to kill process of host application if not close on close OR wait until it closed

My programm need a bit longer to close and that occus that the updater try to overwrite the file of the running process which is closing. This cause that a error window opens that tell me that the updater wan't able to overwrite the specific file. When I click to close the updater tries again.

But this is not realy nice for the end-user. He see the error and make a bug report to me.

How would be a option for the developer who can setup the behavior for what happens if the host application doesn't close after the updater told the process to close?
E.g. setup by changing a property "BehaviorWhenHostApplicationDoesntClose" on UpdateManager of type of an Enum with this values: ShowErrorDialog, KillProcess, WaitForProcessHasClosed

updateInstaller throw IOException

Version: 3.2.1
image

It doesn't happen every time. But, every time this error occurs, the host app directory in Temp is always not cleared. So I added a log in MainForm.Fail(Exception ex),
like this:
System.IO.File.AppendAllText(@"D:\installerLog.txt", ex.StackTrace);
The StackTrace:
在 System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) 在 System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) 在 nUpdate.UpdateInstaller.Updater.CleanUp()

I think it is it was caused by calling Directory.Delete when the thread did not release the host app directory in 'Temp'.

P.S. It is difficult to cause this exception if the files in the update package are too small.

Import projects that have statistics activated

At the moment you can only import projects that have no statistics enabled. The reason is that the version-IDs can differ on the systems and there could be possible conflicts whit other projects that already have these IDs set as it's a Primary Key.

System.ArgumentException at nUpdate.UpdateInstaller.Updater.CopyDirectoryRecursively()

If i try to make an update with an application that run as service i get the following exception :

System.ArgumentException: Der Pfad darf keine leere Zeichenfolge sein oder nur aus Leerzeichen bestehen.
   bei System.IO.Directory.CreateDirectory(String path)
   bei nUpdate.UpdateInstaller.Updater.CopyDirectoryRecursively(String sourceDirName, String destDirName) 

while debugging or if running as normal ui application, the exception doesnt occurs

any ideas ?

Load assembly version from nUpdateVersionAttribute in nUpdate Administration

The nUpdateVersionAttribute has been designed for external access to the assembly's current version, but is not used in the feature provided by nUpdate Administration. This should be changed as this is the only reason why the attribute had been introduced.
I think that there may have been a merge conflict or any other problem as I am pretty sure this had already been implemented some time ago.

How to getting start?

hello,i want to use this,but i don't know how to getting start.can you write wiki to teach me?

nUpdate doesn't wait to install updates until app has closed

Hi,

I want to use nUpdate to update my executable app on launch. Currently have set my instance of the UpdateManager to have a "CloseHostApplication" of "true". However when I run the InstallPackage routine, nUpdate will attempt to overwrite my executable before it's had a chance to close causing it to open a dialog saying the update couldn't be completed.

Is there a way to delay the update from starting for a few seconds to allow time for the app to close?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.