Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add .Net framework prerequisite to setup install

I have a C# WinForms project in MS Visual Studio 2017. I have added a Visual Studio Installer Setup Wizard Project to create an installer for my application. This is my first time using an installer project.

The installer correctly has a prerequisite for .Net framework 4.5.1. However, I would like to make the installer include the .Net framework installation instead of asking the user to download and install it separately at install-time (some of the users' machines don't have internet connections).

I have already set the prerequisites to "Download prerequisites from the same location as my application" in the Setup Property Pages, but when I build the setup I see 3 errors as follows:

ERROR: To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'DotNetFX461\NDP461-KB3102436-x86-x64-AllOS-ENU.exe' for item 'Microsoft .NET Framework 4.6.1 (x86 and x64)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=616018.

The link included doesn't really help as it refers to ClickOnce installs. I have the mentioned NDP461 exe but I don't know where to put it. I see some other questions mention creating a bootstrapper package using the MS Bootstrapper Package Manager, but this seems to have disappeared from the internet with MS's closure of code.msdn.microsoft, with apparently no information on a replacement. Additionally, most documentation and SO questions that I can find on the subject relate to older versions of MSVS, and do not correlate (at least not directly enough for me to figure out!) to MSVS 2017.

How do I go about actually getting the setup project to find the exe? Do I simply need to plop it in the right location (already tried a few that were listed on various MSDN pages and under registry keys)? Or do I need to create a bootstrapper package? If the latter, is there up to date documentation on this process somewhere? Thanks!

PS: Would the process be easier if I chose instead to use the (more recent) .Net framework that is already installed on my development machine? (I'm guessing there might be install information for that already on the machine somewhere)

Update So I tried switching to targeting .NET 4.6 instead, downloaded NDP46-KB3045557-x86-x64-AllOS-ENU.exe and placed it in the directory C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX46. The installer setup project now builds but gives the following warning (again, 3 of them):

WARNING: The value of the 'PublicKey' attribute in 'Microsoft .NET Framework 4.6 (x86 and x64)' does not match that of file 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX46\NDP46-KB3045557-x86-x64-AllOS-ENU.exe'.

I guess this means I'm not supposed to do it this way?

like image 219
Toby Avatar asked Apr 22 '17 11:04

Toby


People also ask

How do I enable .NET Framework?

Select Start > Control Panel > Programs > Programs and Features. Select Turn Windows features on or off. If not already installed, select Microsoft . NET Framework and click OK.


1 Answers

Just download NDP461-KB3102436-x86-x64-AllOS-ENU.exe file from This Link

and copy to C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX461

like image 159
Abolfazl Rastgou Avatar answered Sep 25 '22 00:09

Abolfazl Rastgou