Performs automatic updating for .NET forms projects using github actions.
Supported versions :
- .Net 5.0
- .Net 6.0 (>= 6.0)
Dependencies :
- Cronos (>= 0.7.1)
- MetroFramework (>= 1.2.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 5.0.0)
- Octokit (>= 0.50.0)
- Checks for updates at each startup.
- Checks for updates at runtime. (Optional.)
- Update notes page for user. (Version 2.0.0 and later.)
- Publish an update as mandatory or non-mandatory.
- Turkish and English language supported. (For the update page.)
Download VersionUpdater.Net from Nuget to your project.
Github actions are used for updates. Firstly, you must put the dotnet.yml file in the "/.github/workflows/" folder for the project that you want to apply the update feature to. And you have to adjust the dotnet.yml file configuring to your own project. Just change the variable named "PROJECT_PATH" in the environment.
Example:
PROJECT_PATH: VersionUpdater.Net.Sample/VersionUpdater.Net.Sample.csproj
REPOSITORY: "EmreSeverr/VersionUpdater.Net.Sample"
Then your project *.csproj file, you must enter "Version" information and "UpdateRequired" information.
Example:
<PropertyGroup>
...
<Version>1.0.0</Version>
<UpdateRequired>false</UpdateRequired>
...
</PropertyGroup>
After these operations, after each Github push operation, your project is taken to build and added as an executable file in release.
If you do not increase the version number, release will not occur and you will not have published an update.
Then, add the following code to the "Program.cs" file. And adjust it according to your own project.
static async Task Main()
{
...
await Updater.ApplyVersionUpdaterAsync(p =>
{
p.Owner = {Owner Name};
p.RepositoryName = {Your Repository Name};
p.GithubAuthenticationType = GithubAuthenticationType.Bearer;
p.GithubToken = {Your Github Token};
p.ScheduleConfig = new ScheduleConfig()
{
CronExpression = @"* * * * *",
TimeZoneInfo = TimeZoneInfo.Local
};
}).ConfigureAwait(false);
Application.Run(new Form1());
...
}
Parameter Name | Is Required | Description |
---|---|---|
Owner | ✔️ | Owner name of your repository. |
RepositoryName | ✔️ | Name of your repository. |
GithubAuthenticationType | ✔️ | Github authentication type. |
GithubToken | ❌ | Your Github personnel access token. If your Github repository is private, you must enter the personnel access token. |
ScheduleConfig | ❌ | Will there be runtime Update Check? CronExpression and TimeZoneInfo must be entered if it will be. Otherwise it should be null. (Generate CronExpression) |
If you have published a new update and you force the update to the user, the page on the right is displayed, if you do not, the page on the left is displayed.
Mandatory Update | Non-Mandatory Update |
---|---|
However, you can look at my sample project and download and try the releases I have published.
- Added the update notes page.
To add an update note, you must enter "UpdateDescription" information in "PropertyGroup". If you want to enter more than one update note, you can divide them with the '#' character.
Example:
<PropertyGroup>
...
<UpdateDescription>New Update.#New Release.#New Version.</UpdateDescription>
...
</PropertyGroup>
If you do not enter an update note, "UpdateNotes" will not visible on the update page.
And update note page looks like this :