0

I published a Windows Form application with clickOnce.

When I try to install that application in a computer not used for development, the setup program starts to download and install the whole .net 4.5.2 framework and it takes a lot of time.

My question is pretty simple: is it possible to include somehow the .net framework inside the application so it doesn't have to prompt the user to install it?

Pier Giorgio Misley
  • 5,305
  • 4
  • 27
  • 66

3 Answers3

2

If your application is targeting the full .NET Framework: no you cannot (natively). It needs to be installed on the client machine. There are third party tools available like TurboStudio* which should enable you to accomplish this. My guess would be that slows down the experience for the end user as well. And it will do so each time the application runs, instead of only the first time.

To install the .NET framework straight from your ClickOnce install How to: Include prerequisites with a ClickOnce application.

Before you can distribute prerequisite software with a ClickOnce application, you must first download the installer packages for those prerequisites to your development computer. When you publish an application and choose Download prerequisites from the same location as my application, an error will occur if the installer packages aren't in the Packages folder.

To add an installer package by using Package.xml
1. In File Explorer, open the Packages folder.
2. Open the folder for the prerequisite that you want to add, and then open the language folder for your installed version of Visual Studio (for example, en for English).
3. In Notepad, open the Package.xml file.
4. Locate the Name element that contains http://go.microsoft.com/fwlink, and copy the URL. Include the LinkID portion.
5. Paste the URL into the address bar of your browser, and then, when you are prompted to run or save, choose Save.
6. Copy the file to the root folder for the prerequisite.

You can now distribute the installer package with your application.

*Taken from this SO post: Running .net based application without .NET Framework

rickvdbosch
  • 14,105
  • 2
  • 40
  • 53
2

Right click your project >> Properties >> Publish

There is an option to define pre requisite for your application. Click it and select the .net framework you want to include in the package.

enter image description here

Make sure to select the option to download the prerequisites from the same location as your application so that it is included in the package-

enter image description here

Yogi
  • 9,174
  • 2
  • 46
  • 61
1

Well, .NET Core 3.0 (Still in preview) supports WinForms and WPF and has a self-contained deployment option, but I have to tell it's going to be at least 40 MB because each deployment also contains all of the relevant .NET libraries.

However, all of windows computers have some version of .NET Framework installed on them by default and Windows update updates the .NET framework version as well. And many programs need .NET framework, so most of the time it is not a big deal.

Muhammad Azeez
  • 926
  • 8
  • 18
  • I read on GitHub that someone saying it's a terrible idea because his deployment is going to much larger. Is there a way to prevent this (some way so software get the dll itself and setup are very small) – Anirudha Gupta Jan 02 '19 at 04:47