-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[MicroWin] Fix Recall "Dependency" Misinformation #2947
[MicroWin] Fix Recall "Dependency" Misinformation #2947
Conversation
Fixed the misinformation caused by the Recall feature. Thanks @WitherOrNot and @thecatontheceiling for spotting the problem
# 3. Open the file and do the modification | ||
$appxManifest = Get-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" | ||
$originalLine = $appxManifest[13] | ||
$dependency = "`n <PackageDependency Name=`"Microsoft.WindowsAppRuntime.CBS`" MinVersion=`"1.0.0.0`" Publisher=`"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US`" />" | ||
$appxManifest[13] = "$originalLine$dependency" | ||
Set-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -Value $appxManifest -Force -Encoding utf8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if modifying the app manifest through line numbering is a good idea.. but I can't tell/know a better approach to fix this problem, other then pattern matching using RegEx.. which'll require a bit testing, and some headaches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used this method because I had used it earlier for DT (more on that here) and it works there.
I can't think of another way to insert a line on PowerShell either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I suggest this?
# Set file name
$File = '.\appxmanifest.xml'
# Process lines of text from file and assign result to $NewContent variable
$NewContent = Get-Content -Path $File |
ForEach-Object {
# Output the existing line to pipeline in any case
$_
# If line matches regex
if($_ -match ('^' + [regex]::Escape(' <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.21340.0" MaxVersionTested="10.0.32767.0" />')))
{
# Add output additional line right after it
' <PackageDependency Name="Microsoft.WindowsAppRuntime.CBS" MinVersion="1.0.0.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />'
}
}
# Write content of $NewContent back to file
$NewContent | Out-File -FilePath $File -Encoding Default -Force
from https://superuser.com/questions/821112/add-line-to-text-file-after-specific-line-with-powershell
Applied here as
# 3. Open the file and do the modification
$appxManifest = Get-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" |
ForEach-Object {
# Output the existing line to pipeline in any case
$_
# If line matches regex
if($_ -match ('^' + [regex]::Escape(' <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.21340.0" MaxVersionTested="10.0.32767.0" />')))
{
# Add output additional line right after it
' <PackageDependency Name="Microsoft.WindowsAppRuntime.CBS" MinVersion="1.0.0.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />'
}
}
Set-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -Value $appxManifest -Force -Encoding utf8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other then the suggestion in this review comment, these changes looks good to me, well done @CodingWonders 👍
I don't want to deal with Recall ever again... doing that was as awful as dealing with News and Interests on Windows 10 (which I eventually failed at for the anniversary PR) |
This change can get reverted by a windows update but it's fine since this is only necesarry during windows installation, if the change gets reverted after that then nothing will break |
Type of Change
Description
This PR removes the Recall exclusion and adds the true fix for #2697. Thanks to @WitherOrNot and @thecatontheceiling for spotting this problem, and thanks to Microsoft for not testing Jack.
Testing
Testing has concluded with no issues
Impact
Clarify that it's a Windows bug. This should not have any impact on end-users.
Issue related to PR
Additional Information
Please test this for any issues.
Checklist