Search code examples
installationvisual-studio-2017.net-framework-version

VS2017 installation keeps failing with error as couldn't install Microsoft.Net.4.5.2.TargetingPack


I am trying to install VS2019 and reinstalled it number of times but every time the setup stops in between with a message Setup completed with warning .Net framework 4.5.2 targeting pack didn't install.

In the logs I can see

PackageId:Microsoft.Net.4.5.2.TargetingPack;PackageAction:Install;ReturnCode:1625;

enter image description here

At this stage I'm able to open the VS 2017 but without web template.

enter image description here

Error details :

Package 'Microsoft.Net.4.5.2.TargetingPack,version=4.5.51651.1' failed to install.
Search URL
    https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.Net.4.5.2.TargetingPack;PackageAction=Install;ReturnCode=1625
Details
    MSI: C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Net.4.5.2.TargetingPack,version=4.5.51651.1\netfx_452mtpack.msi, Properties:  REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1  MSIFASTINSTALL="7"  EXTUI="1" 
    Return code: 1625
    Return code details: This installation is forbidden by system policy. Contact your system administrator.
Log
    C:\Users\ihalarnkar162161\AppData\Local\Temp\dd_setup_20200417231054_219_Microsoft.Net.4.5.2.TargetingPack.log
Impacted workloads
    ASP.NET and web development (Microsoft.VisualStudio.Workload.NetWeb,version=15.8.27906.1)
Impacted components
    .NET Framework 4 – 4.6 development tools (Microsoft.Net.ComponentGroup.TargetingPacks.Common,version=15.6.27406.0)
    .NET Framework 4.5.2 targeting pack (Microsoft.Net.Component.4.5.2.TargetingPack,version=15.6.27406.0)
    ASP.NET and web development tools (Microsoft.VisualStudio.Component.Web,version=15.8.27825.0)
    ASP.NET and web development tools prerequisites (Microsoft.VisualStudio.ComponentGroup.Web,version=15.9.28219.51)
    Cloud tools for web development (Microsoft.VisualStudio.ComponentGroup.Web.CloudTools,version=15.8.27729.1)
    Data sources for SQL Server support (Microsoft.VisualStudio.Component.SQL.DataSources,version=15.0.26621.2)
    Microsoft Azure WebJobs Tools (Component.Microsoft.VisualStudio.Web.AzureFunctions,version=15.7.27617.1)
    Microsoft Azure WebJobs Tools (Microsoft.VisualStudio.ComponentGroup.AzureFunctions,version=15.7.27617.1)
    SQL Server Data Tools (Microsoft.VisualStudio.Component.SQL.SSDT,version=15.9.28107.0)
    Windows Communication Foundation (Microsoft.VisualStudio.Component.Wcf.Tooling,version=15.8.27924.0)

Solution

  • Error 1625 indicates:

    ERROR_INSTALL_PACKAGE_REJECTED 1625 This installation is forbidden by system policy. Contact your system administrator.

    According to https://learn.microsoft.com/en-us/windows/win32/msi/error-codes

    My educated guess here will be to run vsinstaller with admin privileges (run as admin), it should fix the issue.

    Let me know if that sort things out