Skip to content

Commit 2e67e7e

Browse files
committed
Fixing WIX visualizers installer
1 parent 6fd37a2 commit 2e67e7e

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

ReadableExpressions.Visualizers.Installer.Custom/VisualizerInstallationActions.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace AgileObjects.ReadableExpressions.Visualizers.Installer.Custom
66
using System.IO;
77
using System.Linq;
88
using System.Reflection;
9-
using System.Security.Permissions;
109
using System.Text;
1110
using System.Text.RegularExpressions;
1211
using Microsoft.Deployment.WindowsInstaller;
@@ -59,7 +58,6 @@ private static string GetVsixManifest()
5958
private static string VsixManifest => _vsixManifestLoader.Value;
6059

6160
[CustomAction]
62-
[SecurityPermission(SecurityAction.Demand)]
6361
public static ActionResult Install(Session session)
6462
{
6563
#if DEBUG
@@ -86,15 +84,15 @@ public static ActionResult Install(Session session)
8684
catch (Exception ex)
8785
{
8886
Log(ex.ToString());
89-
throw;
87+
return ActionResult.Failure;
9088
}
9189
finally
9290
{
9391
_session = null;
9492
}
9593
}
9694

97-
private static void Log(string message) => _session.Log(message);
95+
private static void Log(string message) => _session?.Log(message);
9896

9997
private static IEnumerable<Visualizer> GetRelevantVisualizers()
10098
{
@@ -278,13 +276,21 @@ private static void ResetVsExtensions(Visualizer visualizer)
278276
}
279277

280278
[CustomAction]
281-
[SecurityPermission(SecurityAction.Demand)]
282-
public static void Uninstall(Session session)
279+
public static ActionResult Uninstall(Session session)
283280
{
284-
foreach (var visualizer in GetRelevantVisualizers())
281+
try
282+
{
283+
foreach (var visualizer in GetRelevantVisualizers())
284+
{
285+
Delete(visualizer);
286+
}
287+
}
288+
catch
285289
{
286-
Delete(visualizer);
290+
return ActionResult.Failure;
287291
}
292+
293+
return ActionResult.Success;
288294
}
289295

290296
private static void Delete(Visualizer visualizer)
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Name="AgileObjects.ReadableExpressions.Visualizers" Language="1033" Version="1.8.4.0"
4-
Manufacturer="AgileObjects" UpgradeCode="BB7C528F-ECFD-45F2-B50C-9F0A71EC8BE9">
3+
<Product Id="55937946-0bd4-4fe7-a7f2-ff565dd72e79" Version="1.8.4.0" Name="AgileObjects.ReadableExpressions.Visualizers"
4+
Language="1033" Manufacturer="AgileObjects" UpgradeCode="BB7C528F-ECFD-45F2-B50C-9F0A71EC8BE9">
55
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
66

77
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
88
<MediaTemplate />
99

10+
<Feature Id="ProductFeature" Title="AgileObjects.ReadableExpressions.Visualizers" Level="1">
11+
<ComponentGroupRef Id="ProductComponents" />
12+
</Feature>
13+
1014
<InstallExecuteSequence>
11-
<Custom Action="VisualizersInstall" Sequence="1" />
15+
<Custom Action="VisualizersInstall" After="InstallInitialize" />
1216

13-
<Custom Action="VisualizersUninstall" After="InstallFinalize">
14-
Installed AND NOT UPGRADINGPRODUCTCODE
17+
<Custom Action="VisualizersUninstall" Before="InstallFinalize">
18+
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
1519
</Custom>
1620
</InstallExecuteSequence>
1721
</Product>
1822

1923
<Fragment>
2024
<Directory Id="TARGETDIR" Name="SourceDir">
2125
<Directory Id="ProgramFilesFolder">
22-
<Directory Id="INSTALLFOLDER" Name="AgileObjects.ReadableExpressions.Visualizers.Installer" />
26+
<Directory Id="INSTALLFOLDER" Name="AgileObjects.ReadableExpressions.Visualizers" />
2327
</Directory>
2428
</Directory>
2529
</Fragment>
2630

2731
<Fragment>
32+
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
33+
<Component Id="ProductComponent" Guid="3c7ec38f-cf7c-4cdc-845d-50f4f9f85fdf">
34+
<CreateFolder/>
35+
</Component>
36+
</ComponentGroup>
37+
</Fragment>
38+
39+
<Fragment>
40+
<Binary Id="VisualizersBinary"
41+
SourceFile="$(var.Installer.Custom.TargetDir)\ReadableExpressions.Visualizers.Installer.Custom.CA.dll"/>
42+
2843
<CustomAction Id="VisualizersInstall" BinaryKey="VisualizersBinary"
29-
DllEntry="Install" Execute="immediate" Return="check"/>
44+
DllEntry="Install" Impersonate="no" Execute="deferred" Return="check"/>
3045

3146
<CustomAction Id="VisualizersUninstall" BinaryKey="VisualizersBinary"
32-
DllEntry="Uninstall" Execute="immediate" Return="check"/>
33-
34-
<Binary Id="VisualizersBinary"
35-
SourceFile="$(var.Installer.Custom.TargetDir)\ReadableExpressions.Visualizers.Installer.Custom.CA.dll"/>
47+
DllEntry="Uninstall" Impersonate="no" Execute="deferred" Return="check"/>
3648
</Fragment>
3749
</Wix>

ReadableExpressions.Visualizers.Installer/ReadableExpressions.Visualizers.Installer.wixproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
66
<ProductVersion>3.10</ProductVersion>
7-
<ProjectGuid>1c83f266-d1b7-4910-8069-d82eacc06b6f</ProjectGuid>
7+
<ProjectGuid>f2e07bd5-f32f-4c84-8c9f-30a90c6e8a52</ProjectGuid>
88
<SchemaVersion>2.0</SchemaVersion>
9-
<OutputName>AgileObjects.ReadableExpressions.Visualizers.Installer</OutputName>
9+
<OutputName>AgileObjects.ReadableExpressions.Visualizers</OutputName>
1010
<OutputType>Package</OutputType>
1111
</PropertyGroup>
1212
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">

ReadableExpressions.sln

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26228.10
4+
VisualStudioVersion = 15.0.26403.3
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{884A1D4E-7B9C-4411-A1E5-50B30F243FB1}"
77
ProjectSection(SolutionItems) = preProject
@@ -27,10 +27,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadableExpressions.Visuali
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadableExpressions", "ReadableExpressions\ReadableExpressions.csproj", "{147DDCCE-CDD3-4DD0-8BA3-D3F2F239E161}"
2929
EndProject
30-
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReadableExpressions.Visualizers.Installer", "ReadableExpressions.Visualizers.Installer\ReadableExpressions.Visualizers.Installer.wixproj", "{1C83F266-D1B7-4910-8069-D82EACC06B6F}"
31-
EndProject
3230
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadableExpressions.Visualizers.Installer.Custom", "ReadableExpressions.Visualizers.Installer.Custom\ReadableExpressions.Visualizers.Installer.Custom.csproj", "{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}"
3331
EndProject
32+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReadableExpressions.Visualizers.Installer", "ReadableExpressions.Visualizers.Installer\ReadableExpressions.Visualizers.Installer.wixproj", "{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}"
33+
EndProject
3434
Global
3535
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3636
Debug|Any CPU = Debug|Any CPU
@@ -93,18 +93,18 @@ Global
9393
{147DDCCE-CDD3-4DD0-8BA3-D3F2F239E161}.Release|Any CPU.Build.0 = Release|Any CPU
9494
{147DDCCE-CDD3-4DD0-8BA3-D3F2F239E161}.Release|x86.ActiveCfg = Release|Any CPU
9595
{147DDCCE-CDD3-4DD0-8BA3-D3F2F239E161}.Release|x86.Build.0 = Release|Any CPU
96-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Debug|Any CPU.ActiveCfg = Debug|x86
97-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Debug|x86.ActiveCfg = Debug|x86
98-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Debug|x86.Build.0 = Debug|x86
99-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Release|Any CPU.ActiveCfg = Release|x86
100-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Release|x86.ActiveCfg = Release|x86
101-
{1C83F266-D1B7-4910-8069-D82EACC06B6F}.Release|x86.Build.0 = Release|x86
10296
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Debug|Any CPU.ActiveCfg = Debug|x86
10397
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Debug|x86.ActiveCfg = Debug|x86
10498
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Debug|x86.Build.0 = Debug|x86
10599
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Release|Any CPU.ActiveCfg = Release|x86
106100
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Release|x86.ActiveCfg = Release|x86
107101
{F0FCABC6-52C4-4670-AD28-7DC20B44B13D}.Release|x86.Build.0 = Release|x86
102+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Debug|Any CPU.ActiveCfg = Debug|x86
103+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Debug|x86.ActiveCfg = Debug|x86
104+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Debug|x86.Build.0 = Debug|x86
105+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Release|Any CPU.ActiveCfg = Release|x86
106+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Release|x86.ActiveCfg = Release|x86
107+
{F2E07BD5-F32F-4C84-8C9F-30A90C6E8A52}.Release|x86.Build.0 = Release|x86
108108
EndGlobalSection
109109
GlobalSection(SolutionProperties) = preSolution
110110
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)