I'm trying to write a powershell script that would install asp.net mvc 3 if it is not already installed. How do i check if a specific version of asp.net mvc 3 is installed?
During design time go to “Solution Explorer." Right click on it and expand the “References” folder. Right click on “Web. MVC” Assembly. Then select “Properties” and you can find the versions.
C:\Program Files (x86)\Microsoft ASP.NET Inside this folder will be all versions of MVC that you have installed.
ASP.NET Core MVC 3.1. 1 released on 14 January 2020 is the latest ASP.NET MVC version.
I think you can't change the location of the install folder, so you could probably just:
test-path "${Env:ProgramFiles(x86)}\Microsoft ASP.NET\ASP.NET MVC 3"
Another way (unfortunately quite a bit slower) is to query WMI:
$res = Get-WmiObject Win32_Product | Where {$_.Name -match 'ASP\.NET MVC 3'}
if ($res -ne $null) { ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With