Skip to content

Commit

Permalink
Adding getting started with Uno Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Keboo committed Oct 3, 2024
1 parent 93a1cff commit 5aa0ed4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
49 changes: 49 additions & 0 deletions docs/getting-started/uno.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Getting Started: Uno Platform
<AppliesTo all />

The Uno Platform provies .NET developers with an open-source platform for building single codebase native mobile, web, desktop and embedded apps quickly. Velopack offers a cross platform solution for deploying the desktop (Windows, macOS, and Linux) versions of those applications. For publishing other platforms see [Uno Platform's documentation](https://platform.uno/docs/articles/uno-publishing-overview.html).

0. Start by creating a new Uno application following the Getting Started guide (https://platform.uno/docs/articles/get-started.html).

0. Add the Velopack NuGet package to the Uno project by running
```cmd
dotnet add package Velopack
```

0. Inside of the App.xaml.cs add the following lines to the beginning of the constructor.
```csharp
public App()
{
// It's important to Run() the VelopackApp as early as possible in app startup.
VelopackApp.Build()
.WithFirstRun((v) => { /* Your first run code here */ })
.Run();
this.InitializeComponent();
}
```

0. Compile the artifacts to be deployed. Though it is not strictly necessary to set an assembly version, it is best practice to version the application to match the installer version.
```cmd
dotnet publish -f net8.0-desktop -p:Version=1.0.0 -o .\publish
```
This will create the artifacts to be installed inside of the `publish` directory. If you are targeting Windows or Mac Catalyst separately this process will need to be repeated for each of those platforms.
For additional information on publishing your Uno application see the [Uno publishing guides](https://platform.uno/docs/articles/uno-publishing-overview.html)
0. Install the Velopack command line utility. This is installed as a [dotnet global tool](https://learn.microsoft.com/dotnet/core/tools/global-tools). Install it by running
```cmd
dotnet tool install -g vpk
```

0. Build the installer. For this example, we will provide the same version number for the installer as we did above for the application version.
```cmd
vpk pack --packId <AppId> --packVersion 1.0.0 --packDir .\publish --mainExe <MyUnoApp>.exe
```
The AppId can be any unique application identifier that you wish to use. Typically this will be the same as the name as your application. The --mainExe option is only required if your executable name is different than the --packId of your application.
:::tip
VPK will produce the following warning that can safely be ignored:
`VelopackApp.Run() was found in method 'System.Void <YourAppName>.App::.ctor()', which does not look like your application's entry point. It is strongly recommended that you move this to the very beginning of your Main() method.`
:::
For more information on this warning see [Integration Overview](../integrating/overview.mdx#application-startup)
By default, Velopack will create the installers and the needed installer files inside of a Release directory. This can be configured with the --outputDir option. For more details on the other configuration options see https://docs.velopack.io/packaging/overview
You're Done! These files can then be uploaded it a [variety of locations for distribution](../distributing/overview.mdx).
2 changes: 1 addition & 1 deletion docs/integrating/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_position: 0

To integrate Velopack into your application, you *must* initialise the Velopack as early as possible in app startup, and you *should* add update checking code somewhere.

For .NET applications, you should first install the [Velopack Nuget Package](https://nuget.org/packages/velopack).
For .NET applications, you should first install the [Velopack NuGet Package](https://nuget.org/packages/velopack).

## Application Startup
Velopack requires you add some code to your application startup to handle hooks. This is because Velopack will run your main binary at certain stages of the install/update process with special arguments, to allow you to customise behavior. It expects your app to respond to these arguments in the right way and then exit as soon as possible.
Expand Down
1 change: 1 addition & 0 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const sidebars: SidebarsConfig = {
doc("getting-started/electron", "JS / Electron"),
doc("getting-started/rust", "Rust"),
doc("getting-started/fusion-cli", "Fusion CLI"),
doc("getting-started/uno", "Uno Platform"),
],
link: { type: 'generated-index' },
},
Expand Down

0 comments on commit 5aa0ed4

Please sign in to comment.