0

I used the following code to make a file NOT get deleted during an uninstall:

  <Condition Level="0">
    <![CDATA[REMOVE = "ALL"]]>
  </Condition>

But I guess since I put it in the same which has the of some other files, it made the other files Not uninstallable as well.

<Feature Id="Config_File" Title="Configuration File" Level="1">
  <ComponentRef Id="ProductComponents" />
  <ComponentRef Id="Executable" />     
  <ComponentRef Id="Config_File" />
  <Condition Level="0">
    <![CDATA[REMOVE = "ALL"]]>
  </Condition>
</Feature>

... I also had set the Permanent tag to "yes" for the file I wanted to NOT get deleted during an uninstall:

<Component Id="Config_File" Guid="*" Permanent="yes" NeverOverwrite="yes">
   <File Id="ApplicationConfigFile" Name="application.config" Source=".\application.config" Vital="yes" />
</Component>

My question is: how do I make these files uninstalable again?

  • setting "Level" in the Condition to "0" didn't work either.
  • setting "permanent" to "no" didn't work.

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <!--MediaTemplate /-->
    
    <Media Id="1" Cabinet="SOPHATEL_Server_Management.cab" EmbedCab="yes" />
    
        <Feature Id="ProductFeature" Title="SOPHATEL Server Management" Level="1">
            <!--ComponentGroupRef Id="ProductComponents" /-->
      <ComponentRef Id="ProductComponents" />
      <ComponentRef Id="ProductComponents2" />
      <ComponentRef Id="Executable" />     
        </Feature>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
    

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="SOPHATEL Server Management" />
            </Directory>
        </Directory>
    </Fragment>
    
    <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
    
      <Component Id="ProductComponents" Guid="f5207608-9c81-4317-89de-061066ec863c">
        <File Id="WebAPISelfHostingExe" Name="WebAPISelfHosting.exe" Source="..\WebAPISelfHosting\bin\Debug\WebAPISelfHosting.exe" Vital="yes" />
      </Component>
    
      <Component Id="ProductComponents2" Guid="f5207608-9c81-4317-89de-061066ec863d" NeverOverwrite="yes">
        <File Id="configFile" Name="application.config" Source=".\application.config" Vital="yes" />
      </Component>
    
      <!--Component Id="icon.ico" Guid="7805267a-624b-41e7-baaf-49b82c0439cc">
        <File Id='icon.ico' Name='icon.ico' Source="..\WixInstall\icon.ico" KeyPath='yes' />
      </Component-->
    
      <Component Id="Executable" Guid="f5207608-9c81-4317-89de-061066ec863e">
        <File Id="Service_testExe" Name="Service_test.exe" Source="..\Service_test\bin\Debug\Service_test.exe" Vital="yes" />
        <!-- Remove all files from the INSTALLFOLDER on uninstall -->
        <RemoveFile Id="ALLFILES" Name="*.*" On="both" />
        <!-- Remove INSTALLFOLDER on uninstall -->
        <RemoveFolder Id="INSTALLDIR" On="uninstall" />
        <!-- Tell WiX to install the Service -->        
        <ServiceInstall 
        Id="ServiceInstaller" 
        Type="ownProcess" 
        Name="Service_test" 
        DisplayName="Service_test"
        Description="A Test Service that logs dummy text on an interval to a text file." 
        Start="auto" 
        ErrorControl="normal" />
        <!-- Tell WiX to start the Service -->
        <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="Service_test" Wait="yes" />
    
    </Component>
    </ComponentGroup>
    

All files are NOT uninstallable now, I want to be uninstallable again.

  • Don't have much time. The easiest would probably be to change the main installation directory, generate new component GUIDs (or use [auto-guids](https://stackoverflow.com/questions/24732761/syntax-for-guids-in-wix/24769965#24769965)), use one file per component and only set the file you want permanent to be installed by a component marked with the permanent flag. The new installation folder path has to do with [the component rules, key paths and breaking the link to the sins of the past](https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix/1422121#1422121). – Stein Åsmul Jul 05 '19 at 00:16
  • Changing the GUID worked for me. Thank you – Salaheddine Elhassani Jul 05 '19 at 09:37
  • Are you using major upgrades with early uninstall of old version? (as in location of RemoveExistingProducts in the InstallExecuteSequence) – Stein Åsmul Jul 06 '19 at 09:25
  • I am not using RemoveExistingProducts or InstallExecuteSequence at all, all I have is: But I do have this issue resolved, thank you. – Salaheddine Elhassani Jul 07 '19 at 10:46
  • This issue is more complicated than you think and affects future updates, but maybe you are not live yet? – Stein Åsmul Jul 07 '19 at 14:35

1 Answers1

0

Changing the GUID worked for me. I put in a new GUID, and the files now can be uninstalled.