Reputation: 12711
I'm trying to build a WIX setup but it keep failing.
Error The system cannot find the file 'C:\Work\Test\CustomActionForm\bin\Debug\CustomActionForm.CA.dll'.
My product.wxs file
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject4" Language="1033" Version="1.0.0.0" Manufacturer="MSPmate" UpgradeCode="b9c48ec5-2f0a-4c74-abc6-0c98119861d4">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SetupProject4" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<InstallExecuteSequence>
<Custom Action='CustomActionFormId' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Binary Id="CustomActionBinary" SourceFile="$(var.CustomActionForm.TargetDir)$(var.CustomActionForm.TargetName).CA.dll" />
<CustomAction Id="CustomActionFormId" Impersonate="no" BinaryKey="CustomActionBinary" DllEntry="ShowLicenseInfo" Return="check" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject4" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.WindowsFormsApp1.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
This is my custom action.
namespace CustomActionForm
{
public class CustomAction
{
[CustomAction]
public static ActionResult ShowLicenseInfo(Session session)
{
try
{
session.Log("Custom Action beginning");
MessageBox.Show("Yo hoooooooooo");
// Do Stuff...
//if (cancel)
//{
// session.Log("Custom Action cancelled");
// return ActionResult.Failure;
//}
session.Log("Custom Action completed successfully");
return ActionResult.Success;
}
catch (SecurityException ex)
{
session.Log("Custom Action failed with following exception: " + ex.Message);
return ActionResult.Failure;
}
}
}
}
However, when I build the custom project, it build successfully but cannot even see a *.CA.dll file is generated.
What am I missing here?
Upvotes: 1
Views: 1018
Reputation: 42126
Download Sample Project: Most likely there is something wrong with the compilation of that zip / win32 dll (as opposed to the managed code dll) - please see if you can compile this project outright - "right out of the box": https://github.com/glytzhkof/WiXCustomActionsTesting
Causes?: There could be a simple build failure for the CA dll. There could be something wrong with your Visual Studio - maybe. Might be something completely different. Please just start testing with that sample project.
Build Output: The Visual Studio build output should look something like this:
------ Build started: Project: CustomAction1, Configuration: Debug x86 ------
Searching for custom action entry points in CustomAction1.dll
Loaded dependent assembly: C:\Program Files (x86)\WiX Toolset v3.11\SDK\Microsoft.Deployment.WindowsInstaller.dll
CustomAction1=CustomAction1!CustomAction1.CustomActions.CustomAction1
Searching for an embedded UI class in CustomAction1.dll
Modifying SfxCA.dll stub
Copying file version info from E:\Testing\CA\obj\x86\Debug\CustomAction1.dll to E:\Testing\CA\obj\x86\Debug\CustomAction1.CA.dll
Packaging files
CustomAction1.dll
Microsoft.Deployment.WindowsInstaller.dll
CustomAction1.pdb
CustomAction.config
MakeSfxCA finished: E:\Testing\CA\obj\x86\Debug\CustomAction1.CA.dll
CustomAction1 -> E:\Testing\CA\obj\x86\Debug\CustomAction1.dll
MakeSfxCA.exe: For the record, the building of the CustomAction1.CA.dll
file involves zipping up the managed code dll version CustomAction1.dll
and also its dependencies in a Win32 binary. The file MakeSfxCA.exe (Firegiant's documentation page) is a DTF file (Deployment Tools Foundation). More details here.
DTF.chm: There is more documentation in the DTF.chm
help file located in the WiX installation directory's "doc" sub-folder (normally: "%ProgramFiles(x86)%\WiX Toolset v3.11\doc\DTF.chm"
) - search for MakeSfxCA.exe
.
Upvotes: 1