Foad S. Farimani
Foad S. Farimani

Reputation: 14026

Error running downloaded vs_installer.exe on Windows: "This app can't run on your PC"

I have successfully downloaded Visual Studio Installer using curl with the following command:

C:\Windows\System32\curl.exe -o vs_installer.exe https://aka.ms/vs/17/release/vs_installer.exe

However, when I attempt to run vs_installer.exe --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended --passive, I encounter an error message stating:

This app can't run on your PC
To find a version for your PC, check with the software publisher.

enter image description here

I am unsure how to resolve this issue and would appreciate any guidance. Has anyone else encountered this problem or knows what might be causing it? My goal is to install the Visual Studio Community from the cmd command line.

Upvotes: 0

Views: 275

Answers (2)

Foad S. Farimani
Foad S. Farimani

Reputation: 14026

The issue is likely caused by the downloaded file being incomplete or corrupted due to a redirect in the URL. To resolve this, use the -L option with curl to follow redirects:

C:\Windows\System32\curl.exe -L -o vs_community.exe https://aka.ms/vs/17/release/vs_community.exe

This should download the complete installer file, allowing you to run it without the "This app can't run on your PC" error. After downloading, one can proceed with the original command to install Visual Studio Community.


Bonus point: If you want to install an older version you can do it with

vs_community.exe --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended --passive --channelUri https://aka.ms/vs/16/release/channel

Upvotes: 0

Dou Xu-MSFT
Dou Xu-MSFT

Reputation: 3321

It looks like the url is invalid due to 0KB Size.

https://aka.ms/vs/17/release/vs_installer.exe

enter image description here

If you want to install the Visual Studio Community from the cmd command line, you can follow steps below:

1.Download Visual Studio Installer using cur.

https://aka.ms/vs/17/release/vs_community.exe
C:\Windows\System32\curl.exe -o vs_community.exe https://aka.ms/vs/17/release/vs_community.exe

2.Install Visual Studio via command-line parameters.

vs_community.exe --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended --passive

For more information, please refer to doc: Use command-line parameters to install Visual Studio

Upvotes: 0

Related Questions