-3

I already did some researches and I know that, you can do the Build thing and get the .exe file from bin\release , and you won't need anything other than .Net Framework 4.0 in my case [of course if I wasn't using any other libraries that need to be imported] I did all the tests to make sure my .exe file won't need anything else, but here is the reason I'm posting this .

If I take the .exe only and share it on other computers [that don't have .NET 4.0], does running it prompt them to install the framework , or I really need to add a functionality to check if .NET is installed before starting the application ???

one more question : I believe that the .config, .xml and .pdb are already embedded in the .exe file so I don't really need them in the same directory as the file [I tried moving it to another drive and it did work] so am I right ?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
SixPackScript
  • 111
  • 1
  • 10
  • The simple way to find out is to put your `.exe` file in the computer that doesn't have `.NET Framework` installed and see what happens. You don't have to do any checks in your code. If `.NET` is missing from that particular computer your app will warn the end user. – smr5 Apr 30 '15 at 21:28
  • 2
    @sam that's simply not true. You'll be greeted with https://bd23.https.cdn.softlayer.net/80BD23/142.4.51.106/blog/wp-content/uploads/2008/11/neterror.png – jessehouwing Apr 30 '15 at 21:33

1 Answers1

3

Just running the application won't prompt the user to install the correct .NET Framework. If you want that, you need to create a setup for your application. Either using ClickOnce, Visual Studio Setup Project or Wix. Of those three Wix is the most future proof solution.

Without any .NET Framework installed, users will be greeted with:

enter image description here

Chances that a user doesn't have .NET installed are quite low through. If you're targeting 2.0 or 3.0, then Windows 7 and newer ship with that. And ever since Windows 8 was released, .NET 4.0 ships with it.

As to your other questions: Assume that nothing is embedded in your assembly. Your .pdb, .exe.config and any other item you need will need to ship with the application. Only files set as "Embedded Resource" in your Visual Studio project settings are embedded into the executable. The .pdb (debug symbols) and .exe.config files cannot be embedded.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • ok i basically hate the fact that i need the "Application files" folder with my setup , i want one executable file , so i tough about making a VBS code that checks if .NET is installed, then compile it to .exe and embed files i need then start them IF .net is installed, if not display an error message , is it a good idea ? do you have suggestions – SixPackScript Apr 30 '15 at 21:50
  • That would work. You could also create a 2.0 framework app as bootstrapper, every currently supported Windows version has that installed. – jessehouwing Apr 30 '15 at 21:57
  • The .exe.config, .xml and .pdb are not normally embedded in .exe file. The .exe.config is a copy of the project's app.config. What's in it? It is often not necessary. If it has Configuration Manager settings, they only override the defaults, which are in the .exe if you created them with the Settings designer The .xml file is probably for API documentation and the .pdb is for debugging. They are not necessary for end users. – Tom Blodget May 01 '15 at 00:37
  • Apart from settings of your app, it may contain additional information like connectionstrings for databases, .NET Framework configuration (supported runtimes, security requirements) etc that are not stored as defaults and may be required for your app to launch.Such as: https://msdn.microsoft.com/en-us/library/bbx34a2h%28v=vs.110%29.aspx – jessehouwing May 01 '15 at 08:18