Skip to content

Commit

Permalink
Update to net6.0 / v143 (closes #5, #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Oct 21, 2021
1 parent 29d7a8e commit 225ffcc
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 34 deletions.
6 changes: 2 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ foreach ($Folder in $Folders) {
&"$MSBuildPath" /verbosity:minimal /restore /p:Configuration=Release

# Build single-exe packaged projects
dotnet publish -v minimal -c Release "$PSScriptRoot\src\Update\Update.csproj" -o "$Out" --self-contained true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=true -p:TrimMode=link
Move-Item "$Out\Update.exe" -Destination "$Out\UpdateSelfContained.exe"
dotnet publish -v minimal -c Release "$PSScriptRoot\src\Update\Update.csproj" -o "$Out" --self-contained false
dotnet publish -v minimal -c Release "$PSScriptRoot\src\Update\Update.csproj" -o "$Out"
dotnet publish -v minimal -c Release "$PSScriptRoot\src\SyncReleases\SyncReleases.csproj" -o "$Out"

# Copy over all files we need
Copy-Item "$Out\Update.exe" -Destination "$Out\Squirrel.exe"
Move-Item "$Out\Update.exe" -Destination "$Out\Squirrel.exe"
Move-Item "$Out\Update.com" -Destination "$Out\Squirrel.com"

# Move-Item "$Out\Update.pdb" -Destination "$Out\Squirrel.pdb"
Expand Down
3 changes: 2 additions & 1 deletion src/Clowd.Squirrel.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="DeltaCompressionDotNet" version="2.0.1" />
<dependency id="Mono.Cecil" version="0.11.4" />
<dependency id="SharpCompress" version="0.28.3" />
<dependency id="System.Drawing.Common" version="5.0.2" />
Expand All @@ -27,6 +28,6 @@
<files>
<file src="..\build\Release\netstandard2.0\*" target="lib\netstandard2.0" />
<file src="..\build\publish\*" target="tools" />
<file src="Clowd.Squirrel.props" target="build" />
<!--<file src="Clowd.Squirrel.props" target="build" />-->
</files>
</package>
2 changes: 1 addition & 1 deletion src/Setup/Setup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ProjectGuid>{C1D40624-A484-438A-B846-052F321C89D1}</ProjectGuid>
<ConfigurationType>Application</ConfigurationType>
<Keyword>Win32Proj</Keyword>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<RootNamespace>Setup</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
Expand Down
1 change: 1 addition & 0 deletions src/Squirrel/Squirrel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Squirrel</Description>
<Title>Squirrel</Title>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/StubExecutable/StubExecutable.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ConfigurationType>Application</ConfigurationType>
<Keyword>Win32Proj</Keyword>
<RootNamespace>StubExecutable</RootNamespace>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
Expand Down
11 changes: 7 additions & 4 deletions src/SyncReleases/SyncReleases.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>9</LangVersion>
<RootNamespace>Squirrel.SyncReleases</RootNamespace>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<RootNamespace>Squirrel.SyncReleases</RootNamespace>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
</PropertyGroup>

<ItemGroup>
Expand Down
28 changes: 14 additions & 14 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int executeCommandLine(string[] args)
break;
#endif
case UpdateAction.Releasify:
Releasify(opt.target, opt.releaseDir, opt.bootstrapperExe, opt.backgroundGif, opt.signingParameters, opt.baseUrl, opt.setupIcon, !opt.noMsi, opt.packageAs64Bit, opt.frameworkVersion, !opt.noDelta, opt.selfContained);
Releasify(opt.target, opt.releaseDir, opt.bootstrapperExe, opt.backgroundGif, opt.signingParameters, opt.baseUrl, opt.setupIcon, !opt.noMsi, opt.packageAs64Bit, opt.frameworkVersion, !opt.noDelta);
break;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ public async Task Uninstall(string appName = null)
}
}

public void Releasify(string package, string targetDir = null, string bootstrapperExe = null, string backgroundGif = null, string signingOpts = null, string baseUrl = null, string setupIcon = null, bool generateMsi = true, bool packageAs64Bit = false, string frameworkVersion = null, bool generateDeltas = true, bool selfContained = false)
public void Releasify(string package, string targetDir = null, string bootstrapperExe = null, string backgroundGif = null, string signingOpts = null, string baseUrl = null, string setupIcon = null, bool generateMsi = true, bool packageAs64Bit = false, string frameworkVersion = null, bool generateDeltas = true)
{
ensureConsole();

Expand Down Expand Up @@ -375,7 +375,7 @@ public void Releasify(string package, string targetDir = null, string bootstrapp
.Where(d => re.IsMatch(d))
.OrderBy(d => d.Length)
.FirstOrDefault();
File.Copy(getUpdateExePath(selfContained), Path.Combine(libDir, "Squirrel.exe"));
File.Copy(getUpdateExePath(), Path.Combine(libDir, "Squirrel.exe"));
// sign all exe's in this package
if (signingOpts == null) return;
Expand Down Expand Up @@ -420,7 +420,7 @@ public void Releasify(string package, string targetDir = null, string bootstrapp
var newestFullRelease = releaseEntries.MaxBy(x => x.Version).Where(x => !x.IsDelta).First();

File.Copy(bootstrapperExe, targetSetupExe, true);
var zipPath = createSetupEmbeddedZip(Path.Combine(di.FullName, newestFullRelease.Filename), di.FullName, signingOpts, setupIcon, selfContained).Result;
var zipPath = createSetupEmbeddedZip(Path.Combine(di.FullName, newestFullRelease.Filename), di.FullName, signingOpts, setupIcon).Result;

var writeZipToSetup = Utility.FindHelperExecutable("WriteZipToSetup.exe");

Expand Down Expand Up @@ -566,26 +566,26 @@ void waitForParentToExit()
}
}

string getUpdateExePath(bool selfContained)
string getUpdateExePath()
{
if (selfContained) {
var selfPath = Path.Combine(AssemblyRuntimeInfo.BaseDirectory, "UpdateSelfContained.exe");
if (!File.Exists(selfPath)) {
this.Log().Error("Could not find UpdateSelfContained.exe in base directory. Am I published?");
}
return selfPath;
}
//if (selfContained) {
// var selfPath = Path.Combine(AssemblyRuntimeInfo.BaseDirectory, "UpdateSelfContained.exe");
// if (!File.Exists(selfPath)) {
// this.Log().Error("Could not find UpdateSelfContained.exe in base directory. Am I published?");
// }
// return selfPath;
//}
return AssemblyRuntimeInfo.EntryExePath;
}

async Task<string> createSetupEmbeddedZip(string fullPackage, string releasesDir, string signingOpts, string setupIcon, bool selfContained)
async Task<string> createSetupEmbeddedZip(string fullPackage, string releasesDir, string signingOpts, string setupIcon)
{
string tempPath;

this.Log().Info("Building embedded zip file for Setup.exe");
using (Utility.WithTempDirectory(out tempPath, null)) {
this.ErrorIfThrows(() => {
File.Copy(getUpdateExePath(selfContained), Path.Combine(tempPath, "Update.exe"));
File.Copy(getUpdateExePath(), Path.Combine(tempPath, "Update.exe"));
File.Copy(fullPackage, Path.Combine(tempPath, Path.GetFileName(fullPackage)));
}, "Failed to write package files to temp dir: " + tempPath);

Expand Down
2 changes: 0 additions & 2 deletions src/Update/StartupOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ internal class StartupOption
internal bool packageAs64Bit { get; private set; } = false;
internal bool noDelta { get; private set; } = false;
internal bool onlyUpdateShortcuts { get; private set; } = false;
internal bool selfContained { get; private set; } = false;

public StartupOption(string[] args)
{
Expand Down Expand Up @@ -69,7 +68,6 @@ private OptionSet Parse(string[] args)
{ "framework-version=", "Set the required .NET framework version, e.g. net461", v => frameworkVersion = v },
{ "msi-win64", "Mark the MSI as 64-bit, which is useful in Enterprise deployment scenarios", _ => packageAs64Bit = true},
{ "updateOnly", "Update shortcuts that already exist, rather than creating new ones", _ => onlyUpdateShortcuts = true},
{ "selfContained", "(experimental) Generates a release with a fully self-contained updater that does not have any dependencies", _ => selfContained = true},
};

opts.Parse(args);
Expand Down
15 changes: 9 additions & 6 deletions src/Update/Update.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>WinExe</OutputType>
<LangVersion>9</LangVersion>
<RootNamespace>Squirrel.Update</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ApplicationIcon>squirrel.ico</ApplicationIcon>
<RootNamespace>Squirrel.Update</RootNamespace>
<NoWarn>CA1416</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
</PropertyGroup>

<!-- If update.ico exists in project directory it will be used instead of the squirrel icon -->
Expand Down
2 changes: 1 addition & 1 deletion src/WriteZipToSetup/WriteZipToSetup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ConfigurationType>Application</ConfigurationType>
<Keyword>Win32Proj</Keyword>
<RootNamespace>WriteZipToSetup</RootNamespace>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
Expand Down

0 comments on commit 225ffcc

Please sign in to comment.