Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ jobs:
run: nuget restore

- name: Build
run: msbuild PowerShellWixExtension.sln
run: |
msbuild .\PowerShellWixExtension\PowerShellWixExtension.csproj /p:Configuration=$env:Configuration
msbuild PowerShellWixExtension.sln /p:Configuration=$env:Configuration
# NBGV is run as part of the build, so actions after here have access to NBGV_ env variables.

# For some reason, running msiexec from Pester doesn't work quite right.
- name: msiexec
run: |
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixInlineScriptTest\bin\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixInlineScriptTest\bin\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-uninstall.log"
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixTest\bin\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixTest\bin\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-uninstall.log"
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixInlineScriptTest\bin\x86\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixInlineScriptTest\bin\x86\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-uninstall.log"
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixTest\bin\x86\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixTest\bin\x86\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-uninstall.log"

- name: Pester
id: test_module
Expand Down
4 changes: 2 additions & 2 deletions PowerShellActions/CustomAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Text;
using System.Xml.Linq;
using System.Xml.Serialization;
using Microsoft.Deployment.WindowsInstaller;
using WixToolset.Dtf.WindowsInstaller;

using View = Microsoft.Deployment.WindowsInstaller.View;
using View = WixToolset.Dtf.WindowsInstaller.View;
using System.Collections.Generic;
using System.IO;

Expand Down
67 changes: 10 additions & 57 deletions PowerShellActions/PowerShellActions.csproj
Original file line number Diff line number Diff line change
@@ -1,64 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0A83F788-68C1-4533-8732-6B8E3FBC5282}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PowerShellActions</RootNamespace>
<AssemblyName>PowerShellActions</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
<TargetFramework>net472</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net452">
<Version>1.0.3</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller" />
<Content Include="CustomAction.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<Compile Include="CustomAction.cs" />
<Compile Include="IExitCode.cs" />
<Compile Include="PowerShellTask.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WixHost.cs" />
<Compile Include="WixHostRawUserInterface.cs" />
<Compile Include="WixHostUserInterface.cs" />
<Content Include="CustomAction.config" />
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="6.0.2" />
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="6.0.2" />
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(WixCATargetsPath)" />
</Project>
2 changes: 1 addition & 1 deletion PowerShellActions/PowerShellTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using WixToolset.Dtf.WindowsInstaller;

namespace PowerShellActions
{
Expand Down
2 changes: 1 addition & 1 deletion PowerShellActions/WixHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Management.Automation.Host;
using System.Threading;

using Microsoft.Deployment.WindowsInstaller;
using WixToolset.Dtf.WindowsInstaller;

namespace PowerShellActions
{
Expand Down
2 changes: 1 addition & 1 deletion PowerShellActions/WixHostUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Management.Automation.Host;
using System.Security;

using Microsoft.Deployment.WindowsInstaller;
using WixToolset.Dtf.WindowsInstaller;

namespace PowerShellActions
{
Expand Down
193 changes: 46 additions & 147 deletions PowerShellLibrary/Library.wxs
Original file line number Diff line number Diff line change
@@ -1,160 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<Binary Id="CA_DLL" SourceFile="$(var.PowerShellActions.TargetDir)PowerShellActions.CA.dll" />

<CustomAction Id="PowerShellScriptsImmediate"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsImmediate"
Execute="immediate"
Return="check" />
<CustomAction Id="PowerShellScriptsImmediate" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsImmediate" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellScriptsDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsDeferred" Impersonate="yes" Execute="deferred" Return="check" />
<CustomAction Id="PowerShellScriptsUninstall" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsUninstall" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellScriptsUninstallDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsUninstallDeferred" Impersonate="yes" Execute="deferred" Return="check" />

<CustomAction Id="PowerShellScriptsDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsDeferred"
Impersonate="yes"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellScriptsUninstall"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsUninstall"
Execute="immediate"
Return="check" />
<CustomAction Id="PowerShellScriptsElevatedImmediate" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsElevatedImmediate" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellScriptsElevatedDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsElevatedDeferred" Impersonate="no" Execute="deferred" Return="check" />
<CustomAction Id="PowerShellScriptsElevatedUninstall" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsElevatedUninstall" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellScriptsElevatedUninstallDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellScriptsElevatedUninstallDeferred" Impersonate="no" Execute="deferred" Return="check" />

<CustomAction Id="PowerShellScriptsUninstallDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsUninstallDeferred"
Impersonate="yes"
Execute="deferred"
Return="check" />
<CustomAction Id="PowerShellFilesImmediate" BinaryRef="CA_DLL" DllEntry="PowerShellFilesImmediate" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellFilesDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellFilesDeferred" Impersonate="yes" Execute="deferred" Return="check" />
<CustomAction Id="PowerShellFilesUninstall" BinaryRef="CA_DLL" DllEntry="PowerShellFilesUninstall" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellFilesUninstallDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellFilesUninstallDeferred" Impersonate="yes" Execute="deferred" Return="check" />

<CustomAction Id="PowerShellScriptsElevatedImmediate"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsElevatedImmediate"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellScriptsElevatedDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsElevatedDeferred"
Impersonate="no"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellScriptsElevatedUninstall"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsElevatedUninstall"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellScriptsElevatedUninstallDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellScriptsElevatedUninstallDeferred"
Impersonate="no"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellFilesImmediate"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesImmediate"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellFilesDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesDeferred"
Impersonate="yes"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellFilesUninstall"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesUninstall"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellFilesUninstallDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesUninstallDeferred"
Impersonate="yes"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellFilesElevatedImmediate"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesElevatedImmediate"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellFilesElevatedDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesElevatedDeferred"
Impersonate="no"
Execute="deferred"
Return="check" />

<CustomAction Id="PowerShellFilesElevatedUninstall"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesElevatedUninstall"
Execute="immediate"
Return="check" />

<CustomAction Id="PowerShellFilesElevatedUninstallDeferred"
BinaryKey="CA_DLL"
DllEntry="PowerShellFilesElevatedUninstallDeferred"
Impersonate="no"
Execute="deferred"
Return="check" />
<CustomAction Id="PowerShellFilesElevatedImmediate" BinaryRef="CA_DLL" DllEntry="PowerShellFilesElevatedImmediate" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellFilesElevatedDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellFilesElevatedDeferred" Impersonate="no" Execute="deferred" Return="check" />
<CustomAction Id="PowerShellFilesElevatedUninstall" BinaryRef="CA_DLL" DllEntry="PowerShellFilesElevatedUninstall" Execute="immediate" Return="check" />
<CustomAction Id="PowerShellFilesElevatedUninstallDeferred" BinaryRef="CA_DLL" DllEntry="PowerShellFilesElevatedUninstallDeferred" Impersonate="no" Execute="deferred" Return="check" />

<InstallExecuteSequence>
<!-- These are the 'immediate' actions that prep the data for the 'deferred' actions-->
<Custom Action="PowerShellScriptsImmediate" Before="PowerShellScriptsDeferred" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellScriptsElevatedImmediate" Before="PowerShellScriptsElevatedDeferred" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellFilesImmediate" Before="PowerShellFilesDeferred" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellFilesElevatedImmediate" Before="PowerShellFilesElevatedDeferred" Overridable="yes">NOT Installed</Custom>

<!-- 'Deferred' actions -->
<Custom Action="PowerShellScriptsDeferred" After="InstallFiles" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellScriptsElevatedDeferred" After="InstallFiles" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellFilesDeferred" After="InstallFiles" Overridable="yes">NOT Installed</Custom>

<Custom Action="PowerShellFilesElevatedDeferred" After="InstallFiles" Overridable="yes">NOT Installed</Custom>

<!-- 'Uninstall immediate' actions -->
<Custom Action="PowerShellScriptsUninstall" Before="PowerShellScriptsUninstallDeferred" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellScriptsElevatedUninstall" Before="PowerShellScriptsElevatedUninstallDeferred" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellFilesUninstall" Before="PowerShellFilesUninstallDeferred" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellFilesElevatedUninstall" Before="PowerShellFilesElevatedUninstallDeferred" Overridable="yes">REMOVE="ALL"</Custom>

<!-- 'Uninstall deferred' actions -->
<Custom Action="PowerShellScriptsUninstallDeferred" After="RemoveFiles" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellScriptsElevatedUninstallDeferred" After="RemoveFiles" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellFilesUninstallDeferred" After="RemoveFiles" Overridable="yes">REMOVE="ALL"</Custom>

<Custom Action="PowerShellFilesElevatedUninstallDeferred" After="RemoveFiles" Overridable="yes">REMOVE="ALL"</Custom>
<Custom Action="virtual PowerShellScriptsImmediate" Before="PowerShellScriptsDeferred" Condition="NOT Installed" />
<Custom Action="virtual PowerShellScriptsElevatedImmediate" Before="PowerShellScriptsElevatedDeferred" Condition="NOT Installed" />
<Custom Action="virtual PowerShellFilesImmediate" Before="PowerShellFilesDeferred" Condition="NOT Installed" />
<Custom Action="virtual PowerShellFilesElevatedImmediate" Before="PowerShellFilesElevatedDeferred" Condition="NOT Installed" />

<Custom Action="virtual PowerShellScriptsDeferred" After="InstallFiles" Condition="NOT Installed" />
<Custom Action="virtual PowerShellScriptsElevatedDeferred" After="InstallFiles" Condition="NOT Installed" />
<Custom Action="virtual PowerShellFilesDeferred" After="InstallFiles" Condition="NOT Installed" />
<Custom Action="virtual PowerShellFilesElevatedDeferred" After="InstallFiles" Condition="NOT Installed" />

<Custom Action="virtual PowerShellScriptsUninstall" Before="PowerShellScriptsUninstallDeferred" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellScriptsElevatedUninstall" Before="PowerShellScriptsElevatedUninstallDeferred" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellFilesUninstall" Before="PowerShellFilesUninstallDeferred" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellFilesElevatedUninstall" Before="PowerShellFilesElevatedUninstallDeferred" Condition="REMOVE=&quot;ALL&quot;" />

<Custom Action="virtual PowerShellScriptsUninstallDeferred" After="RemoveFiles" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellScriptsElevatedUninstallDeferred" After="RemoveFiles" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellFilesUninstallDeferred" After="RemoveFiles" Condition="REMOVE=&quot;ALL&quot;" />
<Custom Action="virtual PowerShellFilesElevatedUninstallDeferred" After="RemoveFiles" Condition="REMOVE=&quot;ALL&quot;" />
</InstallExecuteSequence>

<UI>
<ProgressText Action="PowerShellFilesDeferred">PowerShell Files</ProgressText>
<ProgressText Action="PowerShellScriptsDeferred">PowerShell Inline</ProgressText>
<ProgressText Action="PowerShellScriptsElevatedDeferred">PowerShell Inline (elevated)</ProgressText>
<ProgressText Action="PowerShellFilesElevatedDeferred">PowerShell Files (elevated)</ProgressText>

<ProgressText Action="PowerShellFilesUninstallDeferred">PowerShell Uninstall Files</ProgressText>
<ProgressText Action="PowerShellScriptsUninstallDeferred">PowerShell Uninstall Inline</ProgressText>
<ProgressText Action="PowerShellScriptsElevatedUninstallDeferred">PowerShell Uninstall Inline (elevated)</ProgressText>
<ProgressText Action="PowerShellFilesElevatedUninstallDeferred">PowerShell Uninstall Files (elevated)</ProgressText>
</UI>
<ProgressText Action="PowerShellFilesDeferred" Message="PowerShell Files" />
<ProgressText Action="PowerShellScriptsDeferred" Message="PowerShell Inline" />
<ProgressText Action="PowerShellScriptsElevatedDeferred" Message="PowerShell Inline (elevated)" />
<ProgressText Action="PowerShellFilesElevatedDeferred" Message="PowerShell Files (elevated)" />
<ProgressText Action="PowerShellFilesUninstallDeferred" Message="PowerShell Uninstall Files" />
<ProgressText Action="PowerShellScriptsUninstallDeferred" Message="PowerShell Uninstall Inline" />
<ProgressText Action="PowerShellScriptsElevatedUninstallDeferred" Message="PowerShell Uninstall Inline (elevated)" />
<ProgressText Action="PowerShellFilesElevatedUninstallDeferred" Message="PowerShell Uninstall Files (elevated)" />
</UI>
</Fragment>
</Wix>
</Wix>
Loading
Loading