2

I am trying to install Visual Studio 2019 but unfortunately every time I get this error

could not install Microsoft.NetCore.HostPath

Here is an image of the same:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Mian Bilal
  • 31
  • 7
  • Also recently reported here: https://learn.microsoft.com/en-us/answers/questions/667571/visual-studio-2022-installer-couldn39t-install-mic.html – halfer Dec 23 '21 at 23:03
  • What do you get if you click "View Logs"? – halfer Dec 23 '21 at 23:04

5 Answers5

2

Solution worked for me (nothing else helped)

  1. Install PowerShell v7 (https://aka.ms/pscore6)
  2. Backup original PowerShell v1 from C:\Windows\SysWOW64\WindowsPowerShell\v1.0
  3. Copy "C:\Program Files\PowerShell\7" to C:\Windows\SysWOW64\WindowsPowerShell\v1.0
  4. Rename pwsh.exe to powershell.exe
  5. Now VS installer is using PowerShell v7 thinking it is v1, works fine!

So, I believe it is kid of bug in old version of PowerShell

Probably there is better way to mimic version, I just did old school brutal magic after loosing a day for that

Muhammad Dyas Yaskur
  • 6,914
  • 10
  • 48
  • 73
  • Had this exact problem. Just added the v7 files into the WindowsPowerShell-Folder renamed them to 1.0 and renamed the exe. Worked perfectly. After I was done I just renamed the old folder back to 1.0 and everything was back to normal. – Soulstreak Dec 29 '21 at 15:21
1

If you have .Net 5 on your system and updating to 16.11.8 then you may face this issue. Till now only work around is to downgrade to 16.11.7. And you may have in uninstall and then reinstall VS 2019. You can get 16.11.7 or other older version of VS from following URL: https://learn.microsoft.com/en-us/visualstudio/releases/2019/history

Similar issue has been reported here too: Revert Visual Studio 2019 Update

Imran Javed
  • 11,779
  • 2
  • 16
  • 17
0

Activate the PowerShell privilege's, run gpupdate then restart the machine. then reinstall the setup again.

Mian Bilal
  • 31
  • 7
0

Set powershell execution policy to unrestricted. Open privileged powershell console and type

Set-ExecutionPolicy Unrestricted

re-execute setup.

0

Getting Windows PowerShell access worked for me.

I was not able to install VS2019 and VS2022.

Jamil Moughal
  • 19
  • 1
  • 6