Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match WIX logic to wingetcreate #152

Merged
merged 1 commit into from
Feb 14, 2022
Merged

Match WIX logic to wingetcreate #152

merged 1 commit into from
Feb 14, 2022

Conversation

Trenly
Copy link
Owner

@Trenly Trenly commented Feb 11, 2022

@OfficialEsco @jedieaston

As I was working on 3.0, I found a way to extract most of the MSI database to an object in PowerShell. This allows for the same logic as microsoft/winget-create#220 and should more reliably detect WIX installers, even if the CreatedBy doesn't match one of our expected values. This PR backports that solution into the 2.0 script

@OfficialEsco
Copy link
Collaborator

Does this work with and solve the #151 error?

@Trenly
Copy link
Owner Author

Trenly commented Feb 11, 2022

Does this work with and solve the #151 error?

It does work with #151 but it doesn't solve the issue of not being able to detect wix vs msi if the file itself does not end in .msi.

There are multiple reasons for that -

  1. If a file is not truly a windows installer database (msi or wix), then attempting to read the database results in many, many errors. I haven't yet found a way to reliably prevent these errors other than checking the file extension
  2. Powershell and downloading files is weird. Trying to use the method of streaming the content and then saving it using the ContentDisposition header causes issues for several cases with proxies, redirects, user configurations, and all sorts of other things. I believe I have a way around this for v3.0 (still investigating), but there isn't really a way to backport that solution into the 2.0 script without rewriting major sections of the code. This is where (currently) we have to rely on the URLS provided to set the file extension while downloading the file. I do have some work planned to make the detection and matching better, but I don't currently have a way to fix it for most scenarios.
  3. There are only two times when detection of installer type is used. One is in the new package (full update) flow. The automatic detection here shouldn't be critical since it prompts for the installer type if it cannot detect it. If the user sets it to MSI or WIX, then Check for productcode even if extension doesn't match #151 should take over and handle the product code. The second time autodetection is used is during the quick upgrade flow, if and only if the installer type is currently msi. This is to try and detect if a package is actually WIX. The automatic detection isn't critical here since if the downloaded file is not an MSI, then the currently set installer type remains and is not updated. At every point the autodetect is used, if the script isn't 100% certain of the installer type it allows for user input or keeps the input the same.

Copy link
Collaborator

@OfficialEsco OfficialEsco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jedieaston would you mind taking a look at this 🔥 code?

Copy link
Collaborator

@jedieaston jedieaston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh gosh, sorry for the delay. This looks great!

@Trenly Trenly merged this pull request into v2.1.0 Feb 14, 2022
@Trenly Trenly deleted the WixLogic branch February 14, 2022 15:44
Trenly added a commit that referenced this pull request Feb 14, 2022
Trenly added a commit that referenced this pull request Feb 19, 2022
denelon pushed a commit to microsoft/winget-pkgs that referenced this pull request Feb 23, 2022
* Url checking (Trenly#148)

* Prompt user to use direct URL

* Formatting

* Fix: PS7 Resource Delegation

* Ignore github for url checking

* Add messaging for User Experience

* Fix bug where URI could contain invalid characters

* Match WIX logic to wingetcreate (Trenly#152)

* Fix: Don't retain SignatureSha256 between installers

* Culture sorting (Trenly#157)

* Set culture of current thread while running
* Fix Null Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants