mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Add legacy migration test app
This commit is contained in:
@@ -39,6 +39,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{3E
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaCrossPlat", "examples\AvaloniaCrossPlat\AvaloniaCrossPlat.csproj", "{1FF6A262-13D0-45DF-B818-77AC84C52C6F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LegacyTestApp", "test\LegacyTestApp\LegacyTestApp.csproj", "{8B27C4BF-21B8-48B0-80F8-74520227C35F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -89,6 +91,10 @@ Global
|
||||
{1FF6A262-13D0-45DF-B818-77AC84C52C6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1FF6A262-13D0-45DF-B818-77AC84C52C6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1FF6A262-13D0-45DF-B818-77AC84C52C6F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8B27C4BF-21B8-48B0-80F8-74520227C35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8B27C4BF-21B8-48B0-80F8-74520227C35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8B27C4BF-21B8-48B0-80F8-74520227C35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8B27C4BF-21B8-48B0-80F8-74520227C35F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -99,6 +105,7 @@ Global
|
||||
{175B06A5-5C09-4DAB-A6AF-C8A2257BD1B6} = {7AC3A776-B582-4B65-9D03-BD52332B5CA3}
|
||||
{784B5987-2E71-4AEE-81B9-E0CC7F1DBEB3} = {7AC3A776-B582-4B65-9D03-BD52332B5CA3}
|
||||
{1FF6A262-13D0-45DF-B818-77AC84C52C6F} = {3EBFA551-780C-473D-A197-0EE56F2CBA82}
|
||||
{8B27C4BF-21B8-48B0-80F8-74520227C35F} = {7AC3A776-B582-4B65-9D03-BD52332B5CA3}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {68CA987A-9BAB-4C75-8EEB-4596BA6BBD07}
|
||||
|
||||
9
test/LegacyTestApp/BuildClowdV2.ps1
Normal file
9
test/LegacyTestApp/BuildClowdV2.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
Set-Alias Squirrel ($env:USERPROFILE + "\.nuget\packages\clowd.squirrel\2.11.1\tools\Squirrel.exe");
|
||||
|
||||
dotnet build -c Release -p:UseClowd=2.11.1
|
||||
|
||||
./nuget pack LegacyTestApp.nuspec -OutputDirectory bin -BasePath bin/Release/net48
|
||||
|
||||
Squirrel releasify -p bin/LegacyTestApp.1.0.0.nupkg
|
||||
9
test/LegacyTestApp/BuildClowdV3.ps1
Normal file
9
test/LegacyTestApp/BuildClowdV3.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
dotnet build -c Release -p:UseClowd=3.0.210-g5f9f594
|
||||
|
||||
./nuget pack LegacyTestApp.nuspec -OutputDirectory bin -BasePath bin/Release/net48
|
||||
|
||||
dotnet tool install csq --version 3.0.210-g5f9f594 --tool-path bin/csq
|
||||
|
||||
./bin/csq/csq.exe --csq-version 3.0.210-g5f9f594 releasify -p bin/LegacyTestApp.1.0.0.nupkg
|
||||
9
test/LegacyTestApp/BuildSquirrelWin.ps1
Normal file
9
test/LegacyTestApp/BuildSquirrelWin.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
Set-Alias Squirrel ($env:USERPROFILE + "\.nuget\packages\squirrel.windows\2.0.1\tools\Squirrel.com");
|
||||
|
||||
dotnet build -c Release
|
||||
|
||||
./nuget pack LegacyTestApp.nuspec -OutputDirectory bin -BasePath bin/Release/net48
|
||||
|
||||
Squirrel --releasify bin/LegacyTestApp.1.0.0.nupkg --no-msi
|
||||
29
test/LegacyTestApp/LegacyTestApp.csproj
Normal file
29
test/LegacyTestApp/LegacyTestApp.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<!--<UseClowd>2.11.1</UseClowd>-->
|
||||
<!--<UseClowd>3.0.210-*</UseClowd>-->
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition=" $(UseClowd) != '' ">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<DefineConstants>CLOWD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Clowd.Squirrel" Version="$(UseClowd)" />
|
||||
<None Update="LegacyTestApp.exe.squirrel" CopyToOutputDirectory="Always" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="squirrel.windows" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
||||
</Project>
|
||||
1
test/LegacyTestApp/LegacyTestApp.exe.squirrel
Normal file
1
test/LegacyTestApp/LegacyTestApp.exe.squirrel
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
12
test/LegacyTestApp/LegacyTestApp.nuspec
Normal file
12
test/LegacyTestApp/LegacyTestApp.nuspec
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package>
|
||||
<metadata>
|
||||
<id>LegacyTestApp</id>
|
||||
<authors>Velopack</authors>
|
||||
<version>1.0.0</version>
|
||||
<description>LegacyTestApp</description>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="**" target="lib\app\" exclude="*.pdb;*.nupkg;*.vshost.*;**\createdump.exe"/>
|
||||
</files>
|
||||
</package>
|
||||
83
test/LegacyTestApp/Program.cs
Normal file
83
test/LegacyTestApp/Program.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Squirrel;
|
||||
using Squirrel.SimpleSplat;
|
||||
|
||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||
|
||||
namespace LegacyTestApp
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static int Main(string[] args)
|
||||
{
|
||||
#if CLOWD
|
||||
SquirrelAwareApp.HandleEvents(
|
||||
onInitialInstall: (v, t) => debugFile("args.txt", String.Join(" ", args)),
|
||||
onAppUpdate: (v, t) => debugFile("args.txt", String.Join(" ", args)),
|
||||
onAppUninstall: (v, t) => debugFile("args.txt", String.Join(" ", args)),
|
||||
onEveryRun: (v, t, f) => debugFile("args.txt", String.Join(" ", args))
|
||||
);
|
||||
#else
|
||||
SquirrelAwareApp.HandleEvents(
|
||||
onInitialInstall: v => debugFile("args.txt", String.Join(" ", args)),
|
||||
onAppUpdate: v => debugFile("args.txt", String.Join(" ", args)),
|
||||
onAppUninstall: v => debugFile("args.txt", String.Join(" ", args)),
|
||||
onFirstRun: () => debugFile("args.txt", String.Join(" ", args))
|
||||
);
|
||||
#endif
|
||||
|
||||
try {
|
||||
|
||||
SquirrelLogger.Register();
|
||||
|
||||
if (args.Length == 1 && args[0] == "version") {
|
||||
using var um = new UpdateManager("");
|
||||
Console.WriteLine(um.CurrentlyInstalledVersion()?.ToString() ?? "unknown_version");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.Length == 2) {
|
||||
if (args[0] == "check") {
|
||||
using var um = new UpdateManager(args[1]);
|
||||
var info = um.CheckForUpdate().GetAwaiter().GetResult();
|
||||
if (info == null || info.ReleasesToApply == null || info.FutureReleaseEntry == null || info.ReleasesToApply.Count == 0) {
|
||||
Console.WriteLine("no updates");
|
||||
return 0;
|
||||
} else {
|
||||
Console.WriteLine("update: " + info.FutureReleaseEntry.Version);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0] == "download") {
|
||||
using var um = new UpdateManager(args[1]);
|
||||
var entry = um.UpdateApp().GetAwaiter().GetResult();
|
||||
return entry == null ? -1 : 0;
|
||||
}
|
||||
|
||||
if (args[0] == "apply") {
|
||||
UpdateManager.RestartApp();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine("exception: " + ex.ToString());
|
||||
if (Debugger.IsAttached) throw;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Console.WriteLine("Unhandled args: " + String.Join(", ", args));
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void debugFile(string name, string message)
|
||||
{
|
||||
var path = Path.Combine(AppContext.BaseDirectory, "..", name);
|
||||
File.AppendAllText(path, message + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
test/LegacyTestApp/SquirrelLogger.cs
Normal file
27
test/LegacyTestApp/SquirrelLogger.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LegacyTestApp
|
||||
{
|
||||
internal class SquirrelLogger : Squirrel.SimpleSplat.ILogger
|
||||
{
|
||||
protected SquirrelLogger()
|
||||
{
|
||||
}
|
||||
|
||||
public Squirrel.SimpleSplat.LogLevel Level { get; set; }
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
Squirrel.SimpleSplat.SquirrelLocator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Squirrel.SimpleSplat.ILogger));
|
||||
}
|
||||
|
||||
public void Write(string message, Squirrel.SimpleSplat.LogLevel logLevel)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
test/LegacyTestApp/buildall.bat
Normal file
20
test/LegacyTestApp/buildall.bat
Normal file
@@ -0,0 +1,20 @@
|
||||
rmdir /s /q bin
|
||||
rmdir /s /q obj
|
||||
rmdir /s /q releases
|
||||
|
||||
powershell -executionpolicy bypass ./BuildSquirrelWin.ps1
|
||||
copy /Y Releases\Setup.exe ..\fixtures\LegacyTestApp-SquirrelWinV2-Setup.exe
|
||||
|
||||
rmdir /s /q bin
|
||||
rmdir /s /q obj
|
||||
rmdir /s /q releases
|
||||
|
||||
powershell -executionpolicy bypass ./BuildClowdV2.ps1
|
||||
copy /Y releases\LegacyTestAppSetup.exe ..\fixtures\LegacyTestApp-ClowdV2-Setup.exe
|
||||
|
||||
rmdir /s /q bin
|
||||
rmdir /s /q obj
|
||||
rmdir /s /q releases
|
||||
|
||||
powershell -executionpolicy bypass ./BuildClowdV3.ps1
|
||||
copy /Y releases\LegacyTestAppSetup.exe ..\fixtures\LegacyTestApp-ClowdV3-Setup.exe
|
||||
BIN
test/LegacyTestApp/nuget.exe
Normal file
BIN
test/LegacyTestApp/nuget.exe
Normal file
Binary file not shown.
BIN
test/fixtures/LegacyTestApp-ClowdV2-Setup.exe
vendored
Normal file
BIN
test/fixtures/LegacyTestApp-ClowdV2-Setup.exe
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/LegacyTestApp-ClowdV3-Setup.exe
vendored
Normal file
BIN
test/fixtures/LegacyTestApp-ClowdV3-Setup.exe
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/LegacyTestApp-SquirrelWinV2-Setup.exe
vendored
Normal file
BIN
test/fixtures/LegacyTestApp-SquirrelWinV2-Setup.exe
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user