Click here to Skip to main content
11,496,146 members (355 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C# .NET
Hello every body..
I have created a small application using C# with visual studio 2010, and it is working just fine, my question is How to make it a stand alone (one piece) with exe extension which will run on other computer with out needing .Net framework engine, (I know about publish and using set up application i don't want that) for example I want to make my application just like notepad.exe, one click and it will be executed. and another question is how do I know what .Net files my application is need or dll, to include it with my application path.

thank you for reading my question.
Posted 29-Oct-11 4:29am
It depends on what you are prepared to accept.

If you limit yourself (and your application) to .NET version 2.0 or below, and restrict your application to just working on Vista or higher versions of Windows, then you do not need to install any .NET framework - as Vista includes V2.0 of .NET, and Windows 7 includes .NET version 3.5

If you can't accept these restrictions, then you really need to look at not using C# at all, but using Native C++ code instead.
Espen Harlinn at 29-Oct-11 12:21pm
Good points :)
SAKryukov at 29-Oct-11 22:58pm
Good point, a 5.
ahmad1987 at 30-Oct-11 4:59am
thanks OriginalGriff .. but I have visual studio 2010 which is mean I'm using .net 3.5 or higher. so How can I use .net 2.0 or lower in my application using vs 2010?
OriginalGriff at 30-Oct-11 5:37am
Load your solution, then right click the project. from the context menu, select "Properties".
Under the Application Tab, there is a drop down list: Target Framework.
Select the appropriate version, and close the project properties window.
Rebuild your project, and be prepared for error messages if you have used later version features!
ahmad1987 at 31-Oct-11 5:38am
hello Mr. OriginalGriff how you doing? Actually it seems good, and I did what you instructed me to do, but when I chose to change Target Framework I couldn't find a previous .Net versions( but I have previous .Net version and I know that when I navigate to "C:\WINDOWS\Microsoft.NET\Framework" I can find the previous version).
So do you think I should install visual studio 2005 instead to use .net version 2.0? thank you again.
OriginalGriff at 31-Oct-11 6:24am
You shouldn't need to - I have VS2010 only installed on this machine (My HDD failed, so this PC has never even seen the VS2008 disk, let alone VS2005).
When you click on the Target Framework dropdown, what happens?
ahmad1987 at 31-Oct-11 5:49am
my project name is test, so if I go to my project directory and copy only test.exe with out these files ("test.vshost.exe.manifest" and "test2.vshost") will it work just fine on another pc has only old versions of for example .Net version 2.0 ?? .
OriginalGriff at 31-Oct-11 6:23am
No. The version of .NET required is included in the EXE file - as it will call methods and classes that may not have existed in the previous version.
ahmad1987 at 2-Nov-11 4:35am
When you click on the Target Framework dropdown, what happens?

when I click on the target framework dropdown, three option appear to me (.net framework4, .net framework 4 Client profile, and install other framework)
ok let's suppose I have old .net framework installed in my vc 2010 , does my exe file work with out the other files (("test.vshost.exe.manifest" and "test2.vshost")?? thank you very much
OriginalGriff at 2-Nov-11 4:54am
I get .NET 2.0, 3.0, 3.5, 3.5 Client, 4.0, 4.0 Client, and "Install other".
And that's odd - because each framework should contain all the previous ones.

Out of interest, are you running the Express version? If so, then you may not be able to select previous versions (I dunno - I'm not running express so I can't test it).

You do not need the others - they are for debug info, pretty much.
As Griff suggested, rewriting the app in native code (C++ or Delphi) is one way but that may be too much work. It may be easier to convert your app into a web-app. Now clients can access it through a browser without needing the .NET framework.
Espen Harlinn at 29-Oct-11 12:21pm
Good points :)
Nishant Sivakumar at 29-Oct-11 16:46pm
Thank you!
SAKryukov at 29-Oct-11 22:58pm
Right, a 5.
ahmad1987 at 30-Oct-11 5:01am
thank you Nishant,, but my application is using some user32 dll (API), I can't convert it to web application, it seems too difficult.
In an earlier life - at least professionally - Anders Hejlsberg[^] had a thing or two to do with Delphi[^]. So much that C++Builder[^], which is able to utilize the delphi infrastructure will feel quite familiar to c# developers.

Best regards
Espen Harlinn
SAKryukov at 29-Oct-11 22:49pm
Good advice, my 5.
Espen Harlinn at 30-Oct-11 5:17am
Thank you, Sergey!
ahmad1987 at 30-Oct-11 5:04am
thank u Espen. I don't want to make my application so difficult, plus I don't know any thing about Delphi. could you explain more about it?
Espen Harlinn at 30-Oct-11 5:23am
The Delphi runtime libraries (VCL) has many similarities with .Net, so if you know your way around the .Net BCL you will be able to leverage that knowledge with VCL. When you develop in Delphi you use an object oriented variant of pascal, this may seem a bit foreign to a c# developer. C++ Builder on the other hand lets you use C++ and still lets you use the VCL libraries.
ahmad1987 wrote:
How to make it a stand alone (one piece) with exe extension which will run on other computer with out needing .Net framework engine

You can't. Even if your app were to compile to native (search for NGEN), you'd still be referencing a lot of the System dll's. There's the packager from Salamander[^], but it costs quite a bit.

ahmad1987 wrote:
how do I know what .Net files my application is need or dll, to include it with my application path
ClickOnce seems to know what your dependencies are.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 30 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100