10

I'm developing a C#.Net application that uses the .Net Framework but I'm having trouble when users are installing the application on their computers. Some of them just don't know how to install the .Net Framework.

I'm searching for a solution to this problem and I found the self contained deployment use in .Net Core applications.

The problem is that my application doesn't use .Net Core, it is a WPF application.

I already search the web and all solutions I find brings me to the .Net Core self contained deployment.

What can be done in order to deploy a "self contained" .Net Framework application?

Thanks in advance.

underthevoid
  • 513
  • 1
  • 6
  • 17
  • What OS are they installing to? What version? – Cameron MacFarland Feb 16 '19 at 03:56
  • 1
    Have you heard of ClickOnce deployment? Is pretty awesome and is typically what i use to deploy to a share drive and have all my users install app and updates. – Miguel Feb 16 '19 at 03:59
  • @CameronMacFarland The target OS is Windows x86. I need the application to run in all the windows versions from XP to 10. – underthevoid Feb 16 '19 at 04:07
  • @Miguel Yes I have searched for that, but turns out ClickOnce is incompatible with applications that requires to run with Admin privilegies (which is the case of my application). – underthevoid Feb 16 '19 at 04:08
  • Ah, XP. I was wondering what Windows OS doesn't have .NET framework 4+ installed. – Cameron MacFarland Feb 16 '19 at 04:08
  • @CameronMacFarland Yep. However lets say I want to dump XP users and work only with win7+. If I build my application with the .Net Framework 4.0 it will work on every single machine with no need to install any .net dependencies? – underthevoid Feb 16 '19 at 04:16
  • @underthevoid Good point. Win7 comes with .NET 3.5.1 which is has WPF. – Cameron MacFarland Feb 16 '19 at 05:01
  • 1
    If you don't mind spending money, applications such as [ThinApp](https://www.vmware.com/products/thinapp.html) can wrap your executable with all its dependencies into a single exe file. – Idle_Mind Feb 16 '19 at 06:32

2 Answers2

6

You can use WiX to create a "bootstrap" installer, which will install required frameworks before installing your application.

http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html

Cameron MacFarland
  • 70,676
  • 20
  • 104
  • 133
1

Find a version of the .NET Framework that all of your target computers already have, and set Visual Studio to target that version of the framework.

Then, just copy/paste all of the files out of the bin/release folder into a folder on the target computer and run your program's executable.

If all of your target computers have Windows 10, you can deploy using version 4.6 of the framework, and be guaranteed that your clients already have it.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • Thanks for the insight however the windows targets range from windows XP to windows 10. Do you know upfront a possible .Net Framework compatible with all these windows versions? – underthevoid Feb 16 '19 at 04:10
  • 1
    To go back that far, you have to go all the way back to .NET 3.5. Microsoft doesn't support Windows XP anymore; it's incredibly insecure, you can no longer get updates for it, and I strongly discourage you from developing against it. The earliest version of Windows I would contemplate nowadays is Version 7, and Microsoft support for it ends in a couple of years. – Robert Harvey Feb 16 '19 at 04:33
  • Hmm I think I'll accept your suggestion and ignore XP users. If I'm going to work with win7+ do you know which would be the highest framework version I could use? – underthevoid Feb 16 '19 at 04:40
  • Windows 7 supports the latest version of the framework; though it doesn't come with Windows 7 out of the box, there's a good chance it's already there if your users are reasonably good about updates. – Robert Harvey Feb 16 '19 at 04:51
  • This doesn't answer the question. Suggesting a rollback to the previous version is not a solution. – t3chb0t Apr 21 '20 at 10:57
  • @t3chb0t: Not all versions of Windows support all versions of .NET. If you read the comments above, you'll see that the OP needed to support Windows versions all the way back to Windows XP. – Robert Harvey Apr 21 '20 at 13:30
  • 1
    Not by default but what are runtimes for? – t3chb0t Apr 22 '20 at 06:47