I am creating a batch file using wix light and candle to create an msi for a project.
I am receiving this error when i run the batch file:
l
MSBuild: Most people use MSBuild - I believe - to build via the command line like that. There is a section on using MSBuild in the WiX help material.
Custom Action DLL: I include custom action DLLs from within the WiX source file. Here is a sample with hard coded paths in the WiX source file for how you can include your custom action dll:
The construct:
$(env.SystemRoot)
- in the WiX source below - gets the environment variable%SystemRoot%
- which resolves toC:\
on most systems (to list environment variables open acmd.exe
and typeset
and pressEnter
). The below source should hence compile on all systems without modifications:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SimpleCustomAction" Language="1033" Version="1.0.0.0"
Manufacturer="-" UpgradeCode="">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SimpleCustomAction" Level="1" />
<!-- START: Custom action entries -->
<!-- Hard coded SourceFile path to compiled C# dll Win32 wrapper (MakeSfxCA.exe) -->
<Binary Id="CustomActions" SourceFile="C:\CustomAction1.CA.dll" />
<!-- BinaryKey => Use Binary element Id from above entry-->
<!-- DllEntry => Exported method name inside dll (C# method name) -->
<CustomAction Id="SimpleCustomAction" BinaryKey="CustomActions" DllEntry="CustomAction1"/>
<!-- Run custom action -->
<InstallExecuteSequence>
<Custom Action="SimpleCustomAction" After="CostFinalize" />
</InstallExecuteSequence>
<!-- END: Custom action entries -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SimpleCustomAction">
<Component Feature="ProductFeature">
<File Source="$(env.SystemRoot)\notepad.exe" />
</Component>
</Directory>
</Directory>
</Directory>
</Product>
</Wix>
Batch Build: This should suffice, no need to specify anything in the candle.exe
and light.exe
commands to build the MSI. Here are some sample commands:
"%WIX%bin\candle.exe" product.wxs -ext WixUIExtension >> Build.log
"%WIX%bin\light.exe" -out Test.msi product.wixobj -ext WixUIExtension >> Build.log
Custom Action DLLs: I think you might need to take out the
CustomAction.dll
entry in thelight.exe
command line. Maybe take out all entries and add back one entry at a time. See sample command lines below.
CustomAction.dll
- Managed Code assembly dllCustomAction.CA.dll
- Win32 wrapper dll for managed code dll:CustomAction.dll
MakeSfxCA.exe: The latter one is what you should include in your MSI. The DTF (Deployment Tools Foundation) tool MakeSfxCA.exe creates this .CA version of your managed DLL. It contains all the necessary config files for your managed dll to run. You can open CustomAction.CA.dll
with 7Zip or another, capable compression program to see the content.
Batch Build: Minimal command line to build WiX project (if you use a default WiX GUI) - and how-to make a simple WiX project in Visual Studio:
candle.exe product.wxs -ext WixUIExtension
light.exe -out Test.msi product.wixobj -ext WixUIExtension
Votive: I suppose you could try to build the WiX project in Visual Studio to see what command lines are used for candle.exe
and light.exe
in the built output window. That should give you a clue what might not be necessary (I suppose that might be what you already did):
Links: