Wix에서 이전에 설치된 프로그램 버전을 업데이트하는 방법
Wix로 설치 프로그램을 작성했는데 내 프로그램을 설치하는 데 문제가 없습니다. 이제 업데이트해야해서 버전 번호를 올렸지 만 이전 프로그램 위에 새 프로그램을 설치하려고하면 이전 버전이 이미 설치되어 있다는 불만이 제기되고 먼저 제거하라는 메시지가 표시됩니다.
다시 설치하기 전에 업데이트하거나 자동으로 제거하려면 어떻게해야합니까?
제공된 답변 중 어느 것도 완전하거나 독립적 인 것이 없다고 생각하므로이 늪을 파헤친 후 업데이트의 (완전히 자명 한) 요구 사항이 작동하는 데 필요한 단계는 다음과 같습니다.
빌드 할 때마다 제품 ID가 변경되는지 확인하십시오. 그렇지 않은 경우 OP에서 언급 한 "이미 설치됨"메시지가 항상 표시됩니다.
<Product Id="*" ...>
제품 자체가 변경 될 때마다 제품 버전을 변경하십시오. 가장 좋은 방법은 어셈블리 버전 (자동 증가해야 함)에 바인딩하는 것이라고 생각하지만 물론 수동으로 변경할 수도 있습니다. 이 단계는 4 번 지점에서 AllowSameVersionUpgrades 특성을 사용하는 경우 반드시 필요한 것은 아니지만 제품 버전을 일정하게 유지하는 것은 어떤 경우에도 나쁜 습관이라고 말하고 싶습니다.
<Product Version="!(bind.FileVersion.MyAssemblyDll)" ...> <File Id="MyAssemblyDll" Name="$(var.001_Application.MyAssembly.TargetFileName)" Source="$(var.001_Application.MyAssembly.TargetPath)" />
UpgradeCode를 일정하게 유지하십시오 (예 :) :
<Product UpgradeCode="f4d7f199-28f6-45d5-ad99-7c62938274be" ...>
MajorUpgrade 요소를 추가합니다 (Wix 3.5.1315.0에서). MajorUpgrade가 제품 버전의 개정 번호 변경을 무시한다는 캐치를 우회하려면 AllowSameVersionUpgrades (또는 AllowDowngrades를 선호하는 경우) 속성을 추가하십시오. 이렇게하면 예
1.0.0.7
를 들어 에서1.0.0.8
. 뿐 아니라에서1.0.7.0
에1.0.8.0
. 이렇게하지 않으면 프로그램 및 기능에 여러 설치가 표시 될 수 있습니다.<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
다음은 내 전체 .wix 파일입니다 (관련 부품, 제품 바인딩에 사용되는 어셈블리로 이어지는 두 조각은 대부분 선택 사항이며 설명을 위해 어셈블리를 파악할 수있는 모든 방법이 작동합니다).
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion="!(bind.FileVersion.MyAssemblyDll)"?>
<?define UpgradeCode="f4d7f199-28f6-45d5-ad99-7c62938274be"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product
Id="*"
Name="My Product's name"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="My company"
UpgradeCode="$(var.UpgradeCode)"
Codepage="1252">
<Package
InstallerVersion="200"
Compressed="yes"
InstallScope="perUser"
Description="My product description"
Manufacturer="My company"
Languages="1033"
SummaryCodepage="1252"
InstallPrivileges="limited" />
<MajorUpgrade AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A newer version of [ProductName] is already installed. If you are sure you want to downgrade, remove the existing installation via Programs and Features." />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder">
<Directory Id="INSTALLFOLDER" Name="My Install Dir" >
<Component Id="INSTALLFOLDER" Guid="f6ba8a12-6493-4911-8edd-dce90e1d8e8b" >
<RemoveFolder On="both" Id="INSTALLFOLDER"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="My Registry value" />
</Component>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" >
<Component Id="ProductComponent" Guid="1939f0f5-19f6-498b-bf95-8f1c81501294" DiskId="1" Directory="INSTALLFOLDER" >
<File Id="MyAssemblyDll" Name="$(var.001_MyApplication.MyAssembly.TargetFileName)" Source="$(var.001_MyApplication.MyAssembly.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
위에서 언급 한 모든 게시물을 확인했고 여전히이 작업을 수행하기 위해 오랜 세월을 보냈습니다.
The hint on the official HOWTO for upgrades in Step 3 helped a lot: You need a new Product/@Id
to disable the message "Another version of this product is already installed".
I used this upgrade section (child of Product):
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="1.0.0"
IncludeMinimum="yes"
OnlyDetect="no"
Maximum="$(var.Version)"
IncludeMaximum="no"
Property="PREVIOUSFOUND" />
</Upgrade>
Note that OnlyDetect
is set to "no". This triggers the removal of the old version, if you have the following section (child of Product):
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>
Also note that apparently, only the first three components of the version number are used to check for upgrades...
You need to use the upgrade table:
<Upgrade Id='15E2DAFB-35C5-4043-974B-0E342C25D76A'>
<UpgradeVersion Property='OLDVERSIONFOUND' IncludeMinimum='no' Minimum='0.0.0.0' />
</Upgrade>
You need also add an action:
<InstallExecuteSequence>
<LaunchConditions After='AppSearch' />
<RemoveExistingProducts After='InstallValidate' />
</InstallExecuteSequence>
I tried this and it worked for me.
- Put your product tag like this:
Product Id="*" Name="Something" Language="1033" Version="1.0.0.0" Manufacturer="Someone" UpgradeCode="43ab28d7-6681-4a05-a6b5-f980733aeeed"
Product Id should be set to * so that every time you build your project, it takes different id.
- Nest a MajorUpgrade tag inside your Package element which looks like:
MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" /
So, every time you update your version(or your version is same, not less than current version), it reinstalls your product by removing the previous files and installing the product files. It will not downgrade your product.
Just put this element under the Product
element:
<MajorUpgrade AllowDowngrades="yes" />
More info in this HowTo
'Program Tip' 카테고리의 다른 글
onClick 핸들러 내의 JavaScript 코드 내에서 문자열을 어떻게 이스케이프합니까? (0) | 2020.11.20 |
---|---|
WHERE 절에서 별칭 사용 (0) | 2020.11.20 |
postgreSQL에서 테이블 생성 (0) | 2020.11.20 |
node.js의 버퍼에 바이너리 데이터를 추가하는 방법 (0) | 2020.11.20 |
"mscorlib.pdb가로드되지 않음"아직 mscorlib.dll이 누락되지 않았습니다. (0) | 2020.11.20 |