Skip to content

Commit a426bf5

Browse files
committed
Updating Getting Started for Uno Apps
1 parent b70af35 commit a426bf5

File tree

3 files changed

+98
-67
lines changed

3 files changed

+98
-67
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Admonition from '@theme/Admonition';
2+
13
<FancyStep step={props.step} noline={true}>
24
<details>
35
<summary>
@@ -6,10 +8,23 @@
68

79
You are now ready to build a Velopack release for your application.
810

11+
The `--packId` can be any unique application identifier that you wish to use. Because this must be unique across all applications,
12+
we recommend including your company name: `<CompanyName>.<AppName>`.
13+
14+
The `--mainExe` option is only required if your executable name is different than the `--packId` of your application.
15+
916
See the [CLI reference](/reference/cli/) for more details on the available options.
1017

1118
```cmd
12-
vpk pack -u YourAppId -v 1.0.0 -p .\publish -e yourMainApp.exe
19+
vpk pack --packId YourAppId --packVersion 1.0.0 --packDir .\publish --mainExe yourMainApp.exe
1320
```
21+
22+
{props.includeWarningTip && (
23+
<Admonition type="tip">
24+
<code>vpk</code> will produce the a warning saying that the <code>VelopackApp.Run()</code> was
25+
not found in the entry point of your application.
26+
This is expected, and the warning can be safely ignored for this type of application.
27+
</Admonition>
28+
)}
1429
</details>
1530
</FancyStep>

docs/getting-started/content/_csharp-publish.mdx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,36 @@ import Admonition from '@theme/Admonition';
1010

1111
For simplicity, we recommend publishing it as a [self-contained application](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained).
1212

13-
```batch
14-
dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
15-
```
13+
{!props.showMultipleTfmSuggestion && (
14+
<>
15+
<p>
16+
<code className="language-bash">
17+
dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
18+
</code>
19+
</p>
20+
</>
21+
)}
22+
23+
24+
{props.showMultipleTfmSuggestion && (
25+
<>
26+
<p>
27+
<code className="language-cmd">
28+
dotnet publish -f net8.0-desktop -p:Version=1.0.0 -o .\publish
29+
</code>
30+
</p>
31+
<p>
32+
This will create the artifacts to be installed inside of the <code>publish</code> directory. If you are targeting multiple platforms this process will need to be repeated for each of those platforms replacing the <code>-f</code> option with the appropriate target framework moniker (TFM) for each platform, such as <code>net8.0-windows</code> or <code>net8.0-maccatalyst</code>.
33+
</p>
34+
</>
35+
)}
36+
37+
{props.suffix && (
38+
<p>
39+
<span dangerouslySetInnerHTML={{ __html: props.suffix }} />
40+
</p>
41+
)}
42+
1643
<Admonition type="tip">
1744
Starting with .NET 7, the `-o`/`--output` option [can no longer be used with a solution file](https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/7.0/solution-level-output-no-longer-valid?WT.mc_id=DT-MVP-5003472).
1845

docs/getting-started/uno.mdx

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,57 @@
1+
import InstallNuGet from './content/_install-nuget.mdx';
2+
import CSharpUpdates from './content/_csharp-updates.mdx';
3+
import CSharpPublish from './content/_csharp-publish.mdx';
4+
import InstallVpk from './content/_install-vpk.mdx';
5+
import BuildRelease from './content/_build-release.mdx';
6+
import Completion from './content/_completion.mdx';
7+
8+
19
# Getting Started: Uno Platform
210
<AppliesTo all />
311

412
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).
513

6-
1. Start by creating a new Uno application following [Uno Platform's Getting Started guide](https://platform.uno/docs/articles/get-started.html).
7-
8-
0. Add the Velopack NuGet package to the Uno project by running
9-
```cmd
10-
dotnet add package Velopack
11-
```
12-
13-
0. Inside of the App.xaml.cs add the following lines to the beginning of the constructor.
14-
```csharp
15-
public App()
16-
{
17-
// It's important to Run() the VelopackApp as early as possible in app startup.
18-
VelopackApp.Build()
19-
.WithFirstRun((v) => { /* Your first run code here */ })
20-
.Run();
21-
this.InitializeComponent();
22-
}
23-
```
24-
25-
0. Add automatic updating somewhere in your app:
26-
```cs
27-
private static async Task UpdateMyApp()
28-
{
29-
var mgr = new UpdateManager("https://the.place/you-host/updates");
30-
31-
// check for new version
32-
var newVersion = await mgr.CheckForUpdatesAsync();
33-
if (newVersion == null)
34-
return; // no update available
35-
36-
// download new version
37-
await mgr.DownloadUpdatesAsync(newVersion);
38-
39-
// install new version and restart app
40-
mgr.ApplyUpdatesAndRestart(newVersion);
41-
}
42-
```
43-
44-
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.
45-
```cmd
46-
dotnet publish -f net8.0-desktop -p:Version=1.0.0 -o .\publish
47-
```
48-
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.
49-
For additional information on publishing your Uno application see the [Uno publishing guides](https://platform.uno/docs/articles/uno-publishing-overview.html)
50-
51-
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
52-
```cmd
53-
dotnet tool install -g vpk
54-
```
55-
56-
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.
57-
```cmd
58-
vpk pack --packId <AppId> --packVersion 1.0.0 --packDir .\publish --mainExe <MyUnoApp>.exe
59-
```
60-
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.
61-
:::tip
62-
VPK will produce the following warning that can safely be ignored:
63-
`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.`
64-
:::
65-
For more information on this warning see [Integration Overview](../integrating/overview.mdx#application-startup)
66-
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.
67-
68-
✅ You're Done! These files can then be uploaded it a [variety of locations for distribution](../distributing/overview.mdx).
14+
<FancyStep step={1}>
15+
<details>
16+
<summary>
17+
<strong>Create Uno Project</strong>
18+
</summary>
19+
20+
Start by creating a new Uno application following [Uno Platform's Getting Started guide](https://platform.uno/docs/articles/get-started.html).
21+
</details>
22+
</FancyStep>
23+
24+
<InstallNuGet step={2}/>
25+
26+
<FancyStep step={3}>
27+
<details>
28+
<summary>
29+
<strong>Configure Velopack at the beginning of App.xaml.cs</strong>
30+
</summary>
31+
32+
Add the following code to your `App.xaml.cs` file:
33+
```csharp
34+
public App()
35+
{
36+
// It's important to Run() the VelopackApp as early as possible in app startup.
37+
VelopackApp.Build()
38+
.WithFirstRun((v) => { /* Your first run code here */ })
39+
.Run();
40+
this.InitializeComponent();
41+
}
42+
```
43+
</details>
44+
</FancyStep>
45+
46+
<CSharpUpdates step={4}/>
47+
48+
<CSharpPublish step={5}
49+
showMultipleTfmSuggestion={true}
50+
suffix="For additional information on publishing your Uno application see the <a href=&quot;https://platform.uno/docs/articles/uno-publishing-overview.html&quot;>Uno publishing guides</a>"
51+
/>
52+
53+
<InstallVpk step={6}/>
54+
55+
<BuildRelease step={7} includeWarningTip={true}/>
56+
57+
<Completion />

0 commit comments

Comments
 (0)