oleg-shilo / wixsharp

Framework for building a complete MSI or WiX source code by using script files written with C# syntax.
MIT License
1.12k stars 175 forks source link

Bundle ExePackage 'Cache' parameter #1675

Open marcopornic opened 2 days ago

marcopornic commented 2 days ago

Hello,

I'm trying to remove Cache for an ExePackage of a bundle:

` new ExePackage(@".\cm\CM.exe")

     {
        Name = "CMRuntime",
        InstallArguments = "/i /ComponentArgs \"*\":\"/qn ADDLOCAL=Complete,EnableNetworkServer\"",
        DetectCondition = $"cmVersionInstalled = {cmVersionToInstall}",
        Compressed = true,
        Permanent = true,
        Cache = false,
        Vital = true
    }

`

The 'false' value is interpreted as a "no" String for KeepRemoveForceType type (https://wixtoolset.org/docs/schema/wxs/keepremoveforcetype/)

When I try to generate the bundle, have the following error:

error WIX0021: The ExePackage/@Cache attribute's value, 'no', is not on e of the legal options: 'force,keep,remove'.

Thanks for your help !

oleg-shilo commented 6 hours ago

Thank you for reporting. The problem is caused by the changes in the WiX4 API. Now the cache field is no longer boolean.
I have fixed the problem and from the next release you will be able to set the field like this: Cache = PackageCacheAction.remove

But until the release is available please use this workaround:

new ExePackage(msi_exe)
{
    Name = "ManagedProduct",
    InstallArguments = "/i",
    UninstallArguments = "/x",
    AttributesDefinition = "Cache=remove",
    . . .