chocolatey / chocolatey/choco

.NET Framework 4.8 install fails in PowerShell 7

Open
#3,880 1 comment 0 reactions 0 assignees View on GitHub
Bug ClickUp - Backlog
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [x] I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org).
- [x] I have verified this is the correct repository for opening this issue.
- [x] I have verified no other issues exist related to my problem.
- [x] I have verified this is not an issue for a specific package.
- [x] I have verified this issue is not security related.
- [x] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.

### What You Are Seeing?

When running the chocolatey install script in PowerShell 7, the installer for .NET Framework fails.

### What is Expected?

Running the script should install .NET Framework.

### How Did You Get This To Happen?

Open pwsh and run the install command from the website.

### User Story

_No response_

### System Details

* Operating System: Windows 10 LTSC 1809
* Windows PowerShell version: 7.6.0
* Chocolatey CLI Version: 2.6.0
* Chocolatey Licensed Extension version:
* Chocolatey License type:
* Terminal/Emulator:

### Installed Packages

```bash
N/A
```

### Output Log

```bash
Installing Chocolatey on the local machine
The registry key for .Net 4.8 was not found or this is forced
Installing 'C:\Users\\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - this may take awhile with no output.
MethodInvocationException: Exception calling "Start" with "1" argument(s): "An error occurred trying to start process
'ndp48-x86-x64-allos-enu.exe' with working directory 'C:\Users\\AppData\Local\Temp'. The system cannot find the
file specified."
InvalidOperation: You cannot call a method on a null-valued expression.
WARNING: Try #1 of .NET framework install failed with exit code ''. Trying again.
```

### Additional Context

The problem is that the process start cannot find the installer executable. This seems to be caused by the change of the default value of UseShellExecute of True in PowerShell 5 to False in PowerShell 7. I would suggest setting UseShellExecute explicitly to True.

### Acceptance Criteria

_No response_

### Related Issues

_No response_

┆Issue is synchronized with this [Clickup task](https://app.clickup.com/t/868jb9db1) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Chocolatey install command in PowerShell 7 on Windows 10 LTSC 1809 and trace the .NET Framework installer process start that reports the missing executable. Check how UseShellExecute is configured for that launch; done means the .NET Framework installer starts successfully under PowerShell 7 without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.