Enable .Net Framework 3.5 SP1 from 'Programs and Features' and install it using NSIS - frameworks

I am creating installer using nsis for my windows form application. I need .Net Framework 3.5 SP1 as pre-requisites for my application. So using NSIS i check if it is available in client machine or not. If not then it will install it silently. But it gives me an error. I know .Net Framework 3.5 SP1 is required to enable from 'Program and Features' in control panel.
So how can i enable feature '.NET FRAMEWORK 3.5' from control panel using NSIS script.
My nsis section to check and install .Net Framework 3.5 SP1 is :
section
SetOutPath "$temp\Pre_requisites"
; check and install .Net Framework 3.5SP1
ReadRegStr $R1 HKLM "Software\Microsoft\NET Framework Setup\NDP\v3.5" "SP"
${If} $R1 != "1"
DetailPrint "Microsoft .NET Framework 3.5 SP1 needed. Installing..."
File "$temp\Pre_requisites\dotnetfx35.exe"
ExecWait '"$temp\Pre_requisites\dotnetfx35.exe" /q /norestart'
${Else}
DetailPrint "Microsoft .NET Framework 3.5 SP1 Found."
${EndIf}
sectionend
Error message is(I have tried this in windows 7 SP1 64bit):
Thanks..!

Execute below code. It execute dism.exe with enable feature parameter by command prompt for .Net Framework 3.5 online installation.
section
; check and install .Net Framework 3.5SP1
ReadRegStr $R1 HKLM "Software\Microsoft\NET Framework Setup\NDP\v3.5" "SP"
${If} $R1 != "1"
DetailPrint "Microsoft .NET Framework 3.5 SP1 needed. Installing..."
nsExec::Exec 'cmd /c %windir%\system32\dism.exe /Online /Enable-Feature /FeatureName:NetFx3 /All'
${Else}
DetailPrint "Microsoft .NET Framework 3.5 SP1 Found."
${EndIf}
sectionend

Nearly 99,9% of all Windows 7 Installations have installed .Net 3.5 by default. Because it is a feature build in into the source.
Please check the registry to find out wich exact version of .net is installed. If you really need to install .net 3.5 under Windows 7 check out https://technet.microsoft.com/de-de/library/dn482069.aspx. Because you need to use DSIM to install .net 3.5 under Windows 7. The Installer is just for Windows XP and lower.

Related

Starting with PowerShell 5.1

I start learning Windows PowerShell 5.1 on Windows 10, newest version. I use the Microsoft PowerShell documentation https://learn.microsoft.com/en-us/powershell/
Q1: It is mentioned that you need Windows Management Framework (WMF) 5.1 for Windows PowerShell 5.1 but in Windows 10 PowerShell 5.1 is allready installed by default. So there is no WMF 5.1 needed, or is WMF 5.1 installed in Windows 10? How can I see if WMF is installed and which version?
Q2: There are also Microsoft .NET Framework requirements for Windows PowerShell 5.1: It requires the full installation of Microsoft .NET Framework 4.5. How can I find which version of .NET Framework is installed on my PC? I see there allready is a version 4.8 runtime and 4.8 developer pack. So I think the best I can do is install 4.8 Developer Pack?
The reason is that if I want to use and install packages from the PowerShell Gallery I need the PowerShellGet module and the PowerShellGet module requires .NET Framework 4.5 or above.
To determine the DotNet Framework version you can check the registry or use a 3rd party tool: link
For example, you can run this:
(Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
and then check the release table:
.NET Framework 4.5 378389
.NET Framework 4.5.1 378675
.NET Framework 4.5.2 379893
.NET Framework 4.6 393295
.NET Framework 4.6.1 394254
.NET Framework 4.6.2 394802
.NET Framework 4.7 460798
.NET Framework 4.7.1 461308
.NET Framework 4.7.2 461808
.NET Framework 4.8 528040

PowerShell not working on Windows 2008 R2

I have accidently installed .Net 4.5 on my Windows Server 2008 R2 for PowerShell 5.1, but now I have reverted to .Net 4.0 version and now the PowerShell is not working. It gives below error.
Windows PowerShell terminated with the following error: Method not found: 'System.Threading.Tasks.Task System.Threading.Tasks.Task.Run(System.Action)'
What should I do to resolve this?
Perhaps this is the same issue you have: https://michlstechblog.info/blog/powershell-method-not-found-system-threading-tasks-task-system-threading-tasks-task-runsystem-action/
If that does not work for you, you can always reinstall Powershell 3.0. Download it from https://www.microsoft.com/en-us/download/details.aspx?id=34595
You can also install a higher version if you would like. It would do no harm. Reinstall will require a reboot as they come in the form of KBs.
You will need to download Windows Management Framework 3.0 or install Microsoft .NET Framework 4.5 to correct your issue.
Windows Management Framework 3.0 - link
Microsoft .NET Framework 4.0 - link
or you can get
Windows Management Framework 4.0 - link
Microsoft .NET Framework 4.5 - link

.Net framework 4.0 issue on windows 10 os

I am trying to install one windows application on windows 10 platform. My application need to install Dot Net Framework 4.0 when trying to install then error message will appear and say to install Dot Net Framework 4.0 after that when I try to install Dot Net Framework 4.0 then error message shows me Dot Net Framework 4.0 already install in this system so I can't understand what is the issue with that.
Windows 10 included Dot Net Framework 4.0 and above.
Windows 10 (all editions) includes the .NET Framework 4.6 as an OS component, and it is installed by default. It also includes the .NET Framework 3.5 SP1 as an OS component that is not installed by default. The .NET Framework 3.5 SP1 can be added or removed via the Programs and Features control panel.
https://blogs.msdn.microsoft.com/astebner/2007/03/14/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os/
So you don't need to install as already "Installed"...

Application using PowerShell System.Management.Automation compiled on Windows 8 not working on Windows 7

I built a powershell script runner on windows 8 using VS2012 and Framework 4.0 and when I launch the runner on windows 7 it gives me an error because the powershell version is older that the one on windows 8. (Win7: PS2, Win8 PS3). (System.Management.Automation)
Are there any solutions besides recompiling the application on windows 7 or installing powershell 3 on windows 7? (Or upgrading my windows 7 machine :P) Thanks!
You can reference the PowerShell 2.0 version of the assembly (v1) from your project on Windows 8. Compiling with that version will make it work on Windows 7 (PowerShell 2.0) and Windows 8 (PowerShell 3.0).
To get the PowerShell v2.0 version of this assembly you could pull it from the GAC or install the PowerShell 2.0 SDK and use that.
Also make sure your project targets .Net 3.5 for it to work on Windows 7 without having to install .Net 4.5.

Can I install Microsoft .NET Framework 4.5 on Windows 2008 Server Standard SP1

I have Windows server 2008 standard service pack 1 with .Net FrameWork 3.5 sp1, can I install
Microsoft 4.5 framework without installing Microsoft framework 4.0 before?
Also if you look at the system requirements you will see that prerequisite is Windows Server 2008 SP2 while I have only SP1 and it seems I can't install SP2.
I just installed 4.5 on Win2K8 Server and it installed fine (without installing 4.0 prior).
NOTE: In IIS the application pool will still show up at 4.0 although the 4.5 install succeeded.