Skip to content

Commit de86563

Browse files
committed
Updating generic C# instructions
1 parent 91e913b commit de86563

3 files changed

Lines changed: 50 additions & 73 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Admonition from '@theme/Admonition';
2+
3+
<FancyStep step={6}>
4+
<details>
5+
<summary>
6+
<strong>Publish App</strong>
7+
</summary>
8+
9+
Before building a Velopack release, you must first build your application and publish it to a directory.
10+
11+
For simplicity, we recommend publishing it as a [self-contained application](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained).
12+
13+
```batch
14+
dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
15+
```
16+
<Admonition type="tip">
17+
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).
18+
19+
Starting with .NET 8 and later, the `dotnet publish` command defaults to the Release configuration, so you can omit the `-c Release` option.
20+
For more details see https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/dotnet-publish-config.
21+
22+
If you execute the dotnet publish command from within the same directory as the .csproj file, you can omit the project argument. You can find more details on the [dotnet publish documentation](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?WT.mc_id=DT-MVP-5003472#arguments).
23+
</Admonition>
24+
25+
</details>
26+
</FancyStep>

docs/getting-started/csharp.mdx

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
1-
# Getting Started: .NET
1+
import InstallNuGet from './content/_install-nuget.mdx';
2+
import CSharpMain from './content/_csharp-main.mdx';
3+
import CSharpUpdates from './content/_csharp-updates.mdx';
4+
import InstallVpk from './content/_install-vpk.mdx';
5+
import CSharpPublish from './content/_csharp-publish.mdx';
6+
import BuildRelease from './content/_build-release.mdx';
7+
import Completion from './content/_completion.mdx';
8+
9+
# Getting Started: .NET Console / Generic C# App
210
<AppliesTo all />
311
Get started with .NET 5+ (cross-platform) or .NET Framework.
412

5-
1. Install the [Velopack NuGet Package](https://www.nuget.org/packages/velopack) in your main project:
6-
```cmd
7-
dotnet add package Velopack
8-
```
9-
0. Configure your Velopack app at the beginning of `Program.Main`:
10-
```cs
11-
static void Main(string[] args)
12-
{
13-
VelopackApp.Build().Run();
14-
// ... your other startup code below
15-
}
16-
```
17-
0. Add automatic updating to your app:
18-
```cs
19-
private static async Task UpdateMyApp()
20-
{
21-
var mgr = new UpdateManager("https://the.place/you-host/updates");
22-
23-
// check for new version
24-
var newVersion = await mgr.CheckForUpdatesAsync();
25-
if (newVersion == null)
26-
return; // no update available
27-
28-
// download new version
29-
await mgr.DownloadUpdatesAsync(newVersion);
30-
31-
// install new version and restart app
32-
mgr.ApplyUpdatesAndRestart(newVersion);
33-
}
34-
```
35-
0. Install the command line tool `vpk`:
36-
```cmd
37-
dotnet tool update -g vpk
38-
```
39-
0. Publish dotnet and build your first Velopack release! 🎉
40-
```batch
41-
dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
42-
vpk pack -u YourAppId -v 1.0.0 -p .\publish -e yourMainApp.exe
43-
```
44-
:::tip
45-
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).
46-
If you execute the dotnet publish command from within the same directory as the .csproj file, you can omit the project argument. You can find more details on the [dotnet publish documentation](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?WT.mc_id=DT-MVP-5003472#arguments).
47-
:::
48-
49-
✅ You're Done! Your app now has auto-updates and an installer.
50-
You can upload your release to your website, or use the `vpk upload` command to publish it to the destination of your choice.
13+
<InstallNuGet step={1}/>
14+
15+
<CSharpMain step={2}/>
16+
17+
<CSharpUpdates step={3}/>
18+
19+
<InstallVpk step={4}/>
20+
21+
<CSharpPublish step={5}/>
22+
23+
<BuildRelease step={6}/>
24+
25+
<Completion />

docs/getting-started/wpf.mdx

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import InstallNuGet from './content/_install-nuget.mdx';
22
import CSharpMain from './content/_csharp-main.mdx';
33
import CSharpUpdates from './content/_csharp-updates.mdx';
44
import InstallVpk from './content/_install-vpk.mdx';
5+
import CSharpPublish from './content/_csharp-publish.mdx';
56
import BuildRelease from './content/_build-release.mdx';
67
import Completion from './content/_completion.mdx';
7-
import Admonition from '@theme/Admonition';
8-
98

109
# Getting Started: C# / WPF
1110
<AppliesTo win />
@@ -63,30 +62,7 @@ Get started with .NET 5+ (cross-platform) or .NET Framework.
6362

6463
<InstallVpk step={5}/>
6564

66-
<FancyStep step={6}>
67-
<details>
68-
<summary>
69-
<strong>Publish App</strong>
70-
</summary>
71-
72-
Before building a Velopack release, you must first build your application and publish it to a directory.
73-
74-
For simplicity, we recommend publishing it as a [self-contained application](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained).
75-
76-
```batch
77-
dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
78-
```
79-
<Admonition type="tip">
80-
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).
81-
82-
Starting with .NET 8 and later, the `dotnet publish` command defaults to the Release configuration, so you can omit the `-c Release` option.
83-
For more details see https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/dotnet-publish-config.
84-
85-
If you execute the dotnet publish command from within the same directory as the .csproj file, you can omit the project argument. You can find more details on the [dotnet publish documentation](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?WT.mc_id=DT-MVP-5003472#arguments).
86-
</Admonition>
87-
88-
</details>
89-
</FancyStep>
65+
<CSharpPublish step={6}/>
9066

9167
<BuildRelease step={7}/>
9268

0 commit comments

Comments
 (0)