C# application user settings maintained during update
up vote
0
down vote
favorite
I have a C# application that currently stores user settings/configurations in a separate xml file. My application uses a wix installer and id like to know if there is a way to preserve the xml file should the user be installing a newer version of the application if they install without first removing the older version. The xml file is stored in the CommonAppData folder and should be removed if the application is uninstalled.
Backup question - Is there a better way of doing this than my current method?
UPDATE
I have implemented the following code:
<CustomAction Id="Cleanup_Files" Directory="CompanyFolder" ExeCommand="cmd /C RD
"[CommonFolder]" /s /q" Execute="deferred" Return="ignore" HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="Cleanup_Files" Before="RemoveFiles" >
Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
This removes the CommonFolder directory as required on uninstall but it still removes the directory when upgrading. What changes are necessary to achieve this?
c# configuration wix installer settings
add a comment |
up vote
0
down vote
favorite
I have a C# application that currently stores user settings/configurations in a separate xml file. My application uses a wix installer and id like to know if there is a way to preserve the xml file should the user be installing a newer version of the application if they install without first removing the older version. The xml file is stored in the CommonAppData folder and should be removed if the application is uninstalled.
Backup question - Is there a better way of doing this than my current method?
UPDATE
I have implemented the following code:
<CustomAction Id="Cleanup_Files" Directory="CompanyFolder" ExeCommand="cmd /C RD
"[CommonFolder]" /s /q" Execute="deferred" Return="ignore" HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="Cleanup_Files" Before="RemoveFiles" >
Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
This removes the CommonFolder directory as required on uninstall but it still removes the directory when upgrading. What changes are necessary to achieve this?
c# configuration wix installer settings
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a C# application that currently stores user settings/configurations in a separate xml file. My application uses a wix installer and id like to know if there is a way to preserve the xml file should the user be installing a newer version of the application if they install without first removing the older version. The xml file is stored in the CommonAppData folder and should be removed if the application is uninstalled.
Backup question - Is there a better way of doing this than my current method?
UPDATE
I have implemented the following code:
<CustomAction Id="Cleanup_Files" Directory="CompanyFolder" ExeCommand="cmd /C RD
"[CommonFolder]" /s /q" Execute="deferred" Return="ignore" HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="Cleanup_Files" Before="RemoveFiles" >
Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
This removes the CommonFolder directory as required on uninstall but it still removes the directory when upgrading. What changes are necessary to achieve this?
c# configuration wix installer settings
I have a C# application that currently stores user settings/configurations in a separate xml file. My application uses a wix installer and id like to know if there is a way to preserve the xml file should the user be installing a newer version of the application if they install without first removing the older version. The xml file is stored in the CommonAppData folder and should be removed if the application is uninstalled.
Backup question - Is there a better way of doing this than my current method?
UPDATE
I have implemented the following code:
<CustomAction Id="Cleanup_Files" Directory="CompanyFolder" ExeCommand="cmd /C RD
"[CommonFolder]" /s /q" Execute="deferred" Return="ignore" HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="Cleanup_Files" Before="RemoveFiles" >
Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
This removes the CommonFolder directory as required on uninstall but it still removes the directory when upgrading. What changes are necessary to achieve this?
c# configuration wix installer settings
c# configuration wix installer settings
edited yesterday
asked 2 days ago
jhorwood28
144
144
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
The easiest thing to do is: do not insatall this XML file by the setup, but instead let it create by the application if it is not there. By this, an update will not touch the file.
With this scenario it is also possible to migrate the settings from an older (or newer) version.
However, the file will also remain on uninstall. If it is a requirement to remove it in this case, you can do this by a custom action with a condition like Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
add a comment |
up vote
0
down vote
The solution for me was to follow the advice of Klaus but with some additional changes to my product.wxs file. I had to add 'AllowSameVersionUpgrades="yes"' to the MajorUpgrade section.
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of
[ProductName] is already installed." />
Thanks to Klaus for all of their advice!
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The easiest thing to do is: do not insatall this XML file by the setup, but instead let it create by the application if it is not there. By this, an update will not touch the file.
With this scenario it is also possible to migrate the settings from an older (or newer) version.
However, the file will also remain on uninstall. If it is a requirement to remove it in this case, you can do this by a custom action with a condition like Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
add a comment |
up vote
0
down vote
The easiest thing to do is: do not insatall this XML file by the setup, but instead let it create by the application if it is not there. By this, an update will not touch the file.
With this scenario it is also possible to migrate the settings from an older (or newer) version.
However, the file will also remain on uninstall. If it is a requirement to remove it in this case, you can do this by a custom action with a condition like Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
The easiest thing to do is: do not insatall this XML file by the setup, but instead let it create by the application if it is not there. By this, an update will not touch the file.
With this scenario it is also possible to migrate the settings from an older (or newer) version.
However, the file will also remain on uninstall. If it is a requirement to remove it in this case, you can do this by a custom action with a condition like Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
The easiest thing to do is: do not insatall this XML file by the setup, but instead let it create by the application if it is not there. By this, an update will not touch the file.
With this scenario it is also possible to migrate the settings from an older (or newer) version.
However, the file will also remain on uninstall. If it is a requirement to remove it in this case, you can do this by a custom action with a condition like Installed AND REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
answered 2 days ago
Klaus Gütter
814412
814412
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
add a comment |
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
Thanks for your reply, I have not used custom actions before. How do i structure the custom action and where do I place it within the product.wxs file?
– jhorwood28
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
A very simple approach is in this answer: stackoverflow.com/a/17513551/2142950. Smarter solutions require some C# coding,
– Klaus Gütter
2 days ago
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
Hi Klaus, thank you for your advice im still having trouble getting it to keep the files in place during an upgrade (please see my update)
– jhorwood28
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
You can find the installer logs in the %temp% directory. In the log file of the old product being unsinstalled during the update, what is the value of UPGRADINGPRODUCTCODE?
– Klaus Gütter
yesterday
add a comment |
up vote
0
down vote
The solution for me was to follow the advice of Klaus but with some additional changes to my product.wxs file. I had to add 'AllowSameVersionUpgrades="yes"' to the MajorUpgrade section.
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of
[ProductName] is already installed." />
Thanks to Klaus for all of their advice!
add a comment |
up vote
0
down vote
The solution for me was to follow the advice of Klaus but with some additional changes to my product.wxs file. I had to add 'AllowSameVersionUpgrades="yes"' to the MajorUpgrade section.
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of
[ProductName] is already installed." />
Thanks to Klaus for all of their advice!
add a comment |
up vote
0
down vote
up vote
0
down vote
The solution for me was to follow the advice of Klaus but with some additional changes to my product.wxs file. I had to add 'AllowSameVersionUpgrades="yes"' to the MajorUpgrade section.
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of
[ProductName] is already installed." />
Thanks to Klaus for all of their advice!
The solution for me was to follow the advice of Klaus but with some additional changes to my product.wxs file. I had to add 'AllowSameVersionUpgrades="yes"' to the MajorUpgrade section.
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of
[ProductName] is already installed." />
Thanks to Klaus for all of their advice!
answered yesterday
jhorwood28
144
144
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373596%2fc-sharp-application-user-settings-maintained-during-update%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown