Windows installer should warn about missing required updated
Steps to reproduce
- Provision/find/etc. a machine running Windows Server 2008 R2 Server Core and DO NOT apply updates.
- Install the Windows x64 Installer from https://github.com/dotnet/cli/blob/rel/1.0.0/README.md
- Upon completion, run "C:\Program Files\dotnet\dotnet.exe --help"
Expected behavior
The install should warn or block because the required hotfix KB2533623 has not been installed
Actual behavior
The install succeeds and attempts to invoke dotnet.exe result in:
Failed to load the dll from [C:\Program Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057
Environment data
dotnet --info output:
Failed to load the dll from [C:\Program Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057
ver output:
Microsoft Windows [Version 6.1.7601]
CC @schellap
@anurse Does hostfxr.dll exist in that location?
Yes. It is present in that location.
And do you have uCRT installed?
How did you install? Unzip? You need https://support.microsoft.com/en-us/kb/2999226
The SDK setup would install this for you through VC 2015 redist chaining.
I used the EXE
Repurposed this issue to cover adding a check to the installer. This issue is fixed by applying KB2533623, which is a security update, so the installer should indicate that this fix is required if it is not installed.
@anurse I had the same issue on Windows 7 x64 and once I installed IE 11 it's fixed :).
Will this be fixed for 1.0.* versions? I believe I will have to add this check into our current installer because we are depending on .NET Core.
We will try to get it done for an upcoming 1.0.X release but in any case, will have it fixed for 1.2.0 and 1.1.0 RTM.
@schellap Lets chat about this when you get a chance.
@dleeapho @MichaelSimons @leecow, it's fairly common for people to not see that they need to install updates for their their < win10 machines to run .NET Core. It would be nice to detect this during the install and link them to https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore30. Pinging because this is such an old issue I don't think it's come up during triage or similar discussions.
A recent WPF example: https://github.com/dotnet/wpf/issues/2009, and there are countless api-ms-win-crt-runtime-l1-1-0.dll missing errors filed in dotnet/core.
@dagood - How much work is it to make the installer changes to detect the missing updates?
I poked around to try to figure out what we can do in an installer, and found interesting logic to search the registry in WindowsHostingBundle/ANCM.wxs and some specific info about detecting/installing patches at https://stackoverflow.com/a/29946122. (That also includes downloading them, which is nifty, but may be more trouble to set up than it's worth.)
At this point I'd guess it would take a week or two to figure out the right conditions and checks to apply.
Based on https://github.com/dotnet/core-setup/issues/8379#issuecomment-540698953, it looks like we can do somewhat arbitrary registry and product search logic (https://wixtoolset.org/documentation/manual/v3/xsd/util/ has more) and show that as a warning or error on the installer with a link to the docs site's description of the prereqs.
@vatsan-madhavan offered some code in https://github.com/dotnet/wpf/issues/2009#issuecomment-540249133 that checks dependencies, with independent C++ and C# implementations if I understand correctly: https://github.com/vatsanm/checknetcoreprereqs.
@joeloff, please correct me if I'm wrong, but I think it takes a significant amount of work to get actual code or a tool like that running in the bundle due to the overhead of making a WiX extension and getting it runnable by the bootstrapper (or MSI?). However, I'm not familiar with that process.
Bundles can execute abritrary EXEs, but they cannot feed the results back into the engine at install time. By the time an EXE is running, the bundle would be in the apply phase which is too late. For this to work, it needs to run during the detect phase. That would require a custom BA.
You can do this in the MSI, through a custom action, though that will impact our ability to ship the MSIs in VS unless the CA is approved and correctly handles all the necessary cases for install, uninstall, repair, rollback and rollback failures.
Why don't you simply chain the missing KB as the first package in the bundle chain. You can condition it to be installed on the applicable OS. WiX already supports handling both MSPs and MSUs and that's pretty easy to do. In this case you'd want to simply surface a message informing the user that the update is missing and will be applied as part of the install.
Why don't you simply chain the missing KB as the first package in the bundle chain. You can condition it to be installed on the applicable OS. WiX already supports handling both MSPs and MSUs and that's pretty easy to do
That would be the best thing to do, except for the following problem.
One of the KB's is an MSRC update to kernel32.dll. The other KB delivers UCRT.
Ideally, you'd want to deliver Latest KB Package Containing Kernel32.dll and Latest Package of UCRT at all times, so that you are never delivering a KB that is missing security updates to a customer.
This is a hard problem to solve.
The other KB delivers UCRT.
Delivering a version of UCRT chained to our installer maybe less problematic overall than delivering an older copy of kernel32.dll patch. I suspect that UCRT doesn't see a whole lot of security related patching... but I could be wrong. @jamshedd may have an opinion on this.
As to KB2533623, how hard is it to write a custom bootstrapper application that would detect its absence and block setup ? I tried to provide C++ detection example not because I expected you to use my tool as-is - rather I hoped you'd to reuse the code inside setup ;-)
Writing a custom BA is a bit costly. However, detecting KB2999226 is pretty easy to do and block setup with a link that points to the .NET Core page which has details about the UCRT patch and the MSRC for kernel32
Something @joeloff and I discussed in a call that I think's worth mentioning is that we can probably reuse the detection logic already in these patches to reduce dev time and potential mistakes when figuring out what we need to check.
The detections are different for each (UCRT and kernel32 patch), but they yeah, they are each very simple to detect respectively. I think blocking setup is not great, but far better than the current situation.
I'm in favor of blocking setup when KB2533623 (kernel32 lacks support for LOAD_LIBRARY_SEARCH_SYSTEM32 flag, kernel32 is missing AddDllDirectory entrypoint). This was released almost 10 years ago, and we really shouldn't be supporting systems lacking this.
I'm ambivalent wrt whether we should block setup when UCRT is missing, vs. whether we should just carry UCRT in the bundle. I would recommend reflecting on both options before choosing one.
We are deprioritizing this as it is Win7 only. Confirmed that it is already documented and users have a way to install the prereq.