diff --git a/src/Squirrel/UpdateManager.ApplyReleases.cs b/src/Squirrel/UpdateManager.ApplyReleases.cs
index e3116879a..d5d1f021f 100644
--- a/src/Squirrel/UpdateManager.ApplyReleases.cs
+++ b/src/Squirrel/UpdateManager.ApplyReleases.cs
@@ -14,6 +14,7 @@
using Squirrel.Shell;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Core;
+using Microsoft.Win32;
namespace Squirrel
{
@@ -72,6 +73,9 @@ await this.ErrorIfThrows(() => invokePostInstall(newVersion, attemptingFullInsta
this.ErrorIfThrows(() => trayFixer.RemoveDeadEntries(allExes, rootAppDirectory, updateInfo.FutureReleaseEntry.Version.ToString()));
progress(80);
+ unshimOurselves();
+ progress(85);
+
try {
var currentVersion = updateInfo.CurrentlyInstalledVersion != null ?
updateInfo.CurrentlyInstalledVersion.Version : null;
@@ -525,6 +529,33 @@ void updateLink(ShellLink shortcut, string[] oldAppDirectories, string newAppPat
}
}
+ internal void unshimOurselves()
+ {
+ new[] { RegistryView.Registry32, RegistryView.Registry64 }.ForEach(view => {
+ var baseKey = default(RegistryKey);
+ var regKey = default(RegistryKey);
+
+ try {
+ baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, view);
+ regKey = baseKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers");
+
+ var toDelete = regKey.GetValueNames()
+ .Where(x => x.StartsWith(rootAppDirectory, StringComparison.OrdinalIgnoreCase))
+ .ToList();
+
+ toDelete.ForEach(x => regKey.DeleteValue(x));
+
+ //toDelete.ForEach(x =>
+ // this.Log().LogIfThrows(LogLevel.Warn, "Failed to delete key: " + x, () => regKey.DeleteValue(x)));
+ } catch (Exception e) {
+ this.Log().WarnException("Couldn't rewrite shim RegKey, most likely no apps are shimmed", e);
+ } finally {
+ if (regKey != null) regKey.Dispose();
+ if (baseKey != null) baseKey.Dispose();
+ }
+ });
+ }
+
// NB: Once we uninstall the old version of the app, we try to schedule
// it to be deleted at next reboot. Unfortunately, depending on whether
// the user has admin permissions, this can fail. So as a failsafe,
diff --git a/src/Update/Update.csproj b/src/Update/Update.csproj
index a2d402a95..b101a8f74 100644
--- a/src/Update/Update.csproj
+++ b/src/Update/Update.csproj
@@ -34,6 +34,9 @@
+
+ app.manifest
+
..\..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll
@@ -83,6 +86,7 @@
+
PreserveNewest
diff --git a/src/Update/app.manifest b/src/Update/app.manifest
new file mode 100644
index 000000000..b2572585c
--- /dev/null
+++ b/src/Update/app.manifest
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/ApplyReleasesTests.cs b/test/ApplyReleasesTests.cs
index 5ee51a3da..c8821ec79 100644
--- a/test/ApplyReleasesTests.cs
+++ b/test/ApplyReleasesTests.cs
@@ -470,6 +470,17 @@ public async Task CreateShortcutsRoundTrip()
Thread.Sleep(1000);
}
}
+
+ [Fact]
+ public void UnshimOurselvesSmokeTest()
+ {
+ // NB: This smoke test is really more of a manual test - try it
+ // by shimming Slack, then verifying the shim goes away
+ var appDir = Environment.ExpandEnvironmentVariables(@"%LocalAppData%\Slack");
+ var fixture = new UpdateManager.ApplyReleasesImpl(appDir);
+
+ fixture.unshimOurselves();
+ }
[Fact]
public async Task GetShortcutsSmokeTest()