Visual Studio 2022 installation Error


Hello All,

I tried installing Visual Studio 2022 on my Windows 10 (64-bit) company computer (I currently run VS 2019) but after installation I get the error: "Couldn't install Microsoft.NetCore.HostPath".

I need VS 2022 since our solution has been upgraded to .NET 6.0.

Here is my current Windows 10 revision:

20H2 (OS Build 19042.1348)

Does anyone have any solutions for this particular error ?



Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
936 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 23,136 Reputation points Microsoft Vendor

    Hi @Anonymous @mmmoore2288 ,

    The package ‘Microsoft.NetCore.HostPath,version=17.0.31912.81,language=neutral,machinearch=x64’ failed to install due to ‘Access is denied’.

    Please check if you have specialized anti-virus, enterprise group policy, app-blocker, or GPO based permission software installed that may block the installation. Temporarily disabling Windows Defender and\or Windows Defender Controlled Folder Access to retry the installation.

    Besides, something (like CylancePROTECT Script Control) is preventing the powershell script required for the install from being run. Check to see if you can run powershell scripts from command line with administrative privileges.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

2 additional answers

Sort by: Most helpful
  1. Ken Tucker 5,841 Reputation points

    I would try and do a repair on Visual Studio 2022.

  2. mmmoore2288 1 Reputation point

    @Ken Tucker , I have two staff on my end with the same issue. Here's what's in their log files (below).

    Notice the double-backslash in the command: c:\windows\syswow64\windowspowershell\v1.0\powershell.exe

    Could that be the issue?

    Something went wrong with the install.

    You can troubleshoot the package failures by:

    1. Search for solutions using the search URL below for each package failure
    2. Modify your selections for the affected workloads or components and then retry the installation
    3. Remove the product from your machine and then install again

    If the issue has already been reported on the Developer Community, you can find solutions or workarounds there. If the issue has not been reported, we encourage you to create a new issue so that other developers will be able to find solutions or workarounds. You can create a new issue from within the Visual Studio Installer in the upper-right hand corner using the "Provide feedback" button.


    Package 'Microsoft.NetCore.HostPath,version=17.0.31912.81,language=neutral,machinearch=x64' failed to install.
    Search URL;PackageAction=Install;ReturnCode=5
    Command executed: "c:\windows\syswow64\windowspowershell\v1.0\powershell.exe" -NoLogo -NoProfile -Noninteractive -ExecutionPolicy Unrestricted -InputFormat None -Command "& { try { [Environment]::SetEnvironmentVariable("""PATH""", (([System.Environment]::GetEnvironmentVariable("""PATH""", """machine""").Split(""";""") | Where-Object { $_ -ine """${Env:ProgramFiles(x86)}\dotnet\"""}) -Join """;"""), """machine""") } catch { } }"
    Return code: 5
    Return code details: Access is denied.
    Impacted workloads
    .NET desktop development (Microsoft.VisualStudio.Workload.ManagedDesktop,version=17.0.31804.368)
    ASP.NET and web development (Microsoft.VisualStudio.Workload.NetWeb,version=17.0.31804.368)
    Impacted components
    .NET Debugging with WSL (Microsoft.VisualStudio.Component.WslDebugging,version=17.0.31804.368)
    .NET desktop development tools (Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites,version=17.0.31804.368)
    .NET SDK (Microsoft.NetCore.Component.SDK,version=17.0.31912.81)
    ASP.NET and web development prerequisites (Microsoft.VisualStudio.Component.Web,version=17.0.31804.368)
    Azure WebJobs Tools (Component.Microsoft.VisualStudio.Web.AzureFunctions,version=17.0.31804.368)
    Azure WebJobs Tools (Microsoft.VisualStudio.ComponentGroup.AzureFunctions,version=17.0.31804.368)
    Cloud tools for web development (Microsoft.VisualStudio.ComponentGroup.Web.CloudTools,version=17.0.31804.368)
    Container development tools (Microsoft.VisualStudio.Component.DockerTools,version=17.0.31804.368)
    Development tools for .NET (Microsoft.NetCore.Component.DevelopmentTools,version=17.0.31804.368)
    Web development tools for .NET (Microsoft.NetCore.Component.Web,version=17.0.31804.368)