Skip to content

Instantly share code, notes, and snippets.

@spikensbror
Created April 14, 2019 13:40
Show Gist options
  • Save spikensbror/6318adae46f4bb9490315cab5c7680d5 to your computer and use it in GitHub Desktop.
Save spikensbror/6318adae46f4bb9490315cab5c7680d5 to your computer and use it in GitHub Desktop.
Hack to get MakeSfxCA.exe packaging of WiX custom actions to work for long paths.
<!-- Run the MakeSfxCA.exe CA packaging tool. -->
<!--<Exec Command='"$(MakeSfxCA)" "@(IntermediateCAPackage)" "$(SfxCADll)" "@(IntermediateCAAssembly)" "$(CustomActionContents)"' WorkingDirectory="$(ProjectDir)" />-->
<PropertyGroup>
<PowerShellTempFileName>$([System.IO.Path]::GetTempPath())$([System.Guid]::NewGuid()).ps1</PowerShellTempFileName>
<PowerShellContent>&amp; "$(MakeSfxCA)" "@(IntermediateCAPackage)" "$(SfxCADll)" "@(IntermediateCAAssembly)" "$([System.String]::Join(";", $(CustomActionContents)))"</PowerShellContent>
</PropertyGroup>
<WriteLinesToFile File="$(PowerShellTempFileName)" Lines="$(PowerShellContent)" Overwrite="true" Encoding="Unicode" />
<Exec Command='powershell -command "Set-ExecutionPolicy -Scope CurrentUser RemoteSigned"' />
<Exec Command='powershell -command "Unblock-File -Path {$(PowerShellTempFileName)}"' />
<Exec Command='powershell -command "&amp; \"$(PowerShellTempFileName)\""' WorkingDirectory="$(ProjectDir)" />
<Delete Files="$(PowerShellTempFileName)" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment