|
10 | 10 | <RootNamespace>DiffViewer</RootNamespace> |
11 | 11 | <AssemblyName>DiffViewer</AssemblyName> |
12 | 12 | <ApplicationIcon>Assets\diffviewer.ico</ApplicationIcon> |
| 13 | + |
| 14 | + <!-- Velopack requires a hook (VelopackApp.Build().Run()) that |
| 15 | + runs before WPF spins up. WPF's auto-generated Program.Main |
| 16 | + doesn't give us that seam, so we provide our own static Main |
| 17 | + in App.xaml.cs and point StartupObject at it. The Page swap |
| 18 | + below (App.xaml from ApplicationDefinition to Page) is the |
| 19 | + companion change that stops WPF from generating its own |
| 20 | + Main and creating a duplicate-entry-point error. Both knobs |
| 21 | + apply to every build configuration — the Velopack hook is |
| 22 | + a no-op when running outside an installed location, so |
| 23 | + portable / dev builds aren't affected. --> |
| 24 | + <StartupObject>DiffViewer.App</StartupObject> |
| 25 | + |
| 26 | + <!-- Selects the publish layout produced by `dotnet publish`. |
| 27 | + Portable (default) — single-file self-extracting exe (today's |
| 28 | + shape); matches the README's documented |
| 29 | + "Build from source" workflow and the |
| 30 | + shape the v1.x releases ship. |
| 31 | + Setup — non-single-file folder layout that |
| 32 | + `vpk pack` wraps into a Velopack installer. |
| 33 | + Built with |
| 34 | + `dotnet publish -p:DiffViewerBuildMode=Setup`. |
| 35 | + Used by the Phase 3 release workflow's |
| 36 | + auto-update lane. |
| 37 | + Both modes are self-contained win-x64. --> |
| 38 | + <DiffViewerBuildMode Condition="'$(DiffViewerBuildMode)' == ''">Portable</DiffViewerBuildMode> |
| 39 | + |
13 | 40 | <!-- DiffViewer's own strings are hard-coded English; no .resx, no |
14 | 41 | x:Uid. The 11 framework locale folders shipped by the .NET |
15 | 42 | desktop runtime (cs/de/es/fr/it/ja/ko/pl/pt-BR/ru/tr) only |
|
26 | 53 | <Resource Include="Assets\diffviewer.ico" /> |
27 | 54 | </ItemGroup> |
28 | 55 |
|
| 56 | + <ItemGroup> |
| 57 | + <!-- Re-declare App.xaml from ApplicationDefinition to Page so WPF |
| 58 | + stops auto-generating Program.Main. Our own static Main lives |
| 59 | + in App.xaml.cs and runs VelopackApp.Build().Run() before WPF |
| 60 | + spins up. Required pairing with <StartupObject> above. Per the |
| 61 | + Velopack WPF sample csproj. --> |
| 62 | + <ApplicationDefinition Remove="App.xaml" /> |
| 63 | + <Page Include="App.xaml" /> |
| 64 | + </ItemGroup> |
| 65 | + |
29 | 66 | <ItemGroup> |
30 | 67 | <!-- Hand-authored AvalonEdit syntax-highlighting definitions (TypeScript, |
31 | 68 | YAML, Go, Rust, Ruby, Bash, TOML). Registered at app startup via |
|
35 | 72 | </ItemGroup> |
36 | 73 |
|
37 | 74 | <PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
38 | | - <PublishSingleFile>true</PublishSingleFile> |
39 | 75 | <SelfContained>true</SelfContained> |
40 | 76 | <RuntimeIdentifier>win-x64</RuntimeIdentifier> |
41 | | - <!-- LOAD-BEARING for LibGit2Sharp: ships native git2-*.dll that |
42 | | - must be extracted from the single-file bundle at runtime. |
43 | | - Do NOT remove without testing on a clean machine. --> |
| 77 | + </PropertyGroup> |
| 78 | + |
| 79 | + <!-- Portable build: single-file self-extracting exe (today's shape). |
| 80 | + Built with `dotnet publish -p:DiffViewerBuildMode=Portable -c Release`. |
| 81 | + IncludeNativeLibrariesForSelfExtract is LOAD-BEARING here: it ships |
| 82 | + LibGit2Sharp's native git2-*.dll inside the bundle so it can be |
| 83 | + extracted to %TEMP% on first launch. Do NOT remove without testing |
| 84 | + on a clean machine. --> |
| 85 | + <PropertyGroup Condition="'$(Configuration)' == 'Release' AND '$(DiffViewerBuildMode)' == 'Portable'"> |
| 86 | + <PublishSingleFile>true</PublishSingleFile> |
44 | 87 | <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> |
45 | 88 | </PropertyGroup> |
46 | 89 |
|
| 90 | + <!-- Setup build (default): non-single-file folder layout that |
| 91 | + `vpk pack` wraps into a Velopack installer. Native git2-*.dll |
| 92 | + ships loose alongside DiffViewer.exe and is picked up by the OS |
| 93 | + loader directly — no self-extract needed. Verified end-to-end |
| 94 | + by the Phase 1 spike on branch spike/velopack. --> |
| 95 | + |
47 | 96 | <ItemGroup> |
48 | 97 | <InternalsVisibleTo Include="DiffViewer.Tests" /> |
49 | 98 | </ItemGroup> |
|
55 | 104 | <PackageReference Include="LibGit2Sharp" Version="0.31.0" /> |
56 | 105 | <PackageReference Include="SharpVectors.Wpf" Version="1.8.5" /> |
57 | 106 | <PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" /> |
| 107 | + <PackageReference Include="Velopack" Version="1.1.1" /> |
58 | 108 | </ItemGroup> |
59 | 109 |
|
60 | 110 | </Project> |
0 commit comments