Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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

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.
 
Share this answer
 
Comments
Espen Harlinn 29-Oct-11 12:21pm    
Good points :)
Sergey Alexandrovich Kryukov 29-Oct-11 22:58pm    
Good point, a 5.
--SA
ahmad1987 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 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 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.
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.
 
Share this answer
 
v2
Comments
Espen Harlinn 29-Oct-11 12:21pm    
Good points :)
Nish Nishant 29-Oct-11 16:46pm    
Thank you!
Sergey Alexandrovich Kryukov 29-Oct-11 22:58pm    
Right, a 5.
--SA
ahmad1987 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
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Oct-11 22:49pm    
Good advice, my 5.
--SA
Espen Harlinn 30-Oct-11 5:17am    
Thank you, Sergey!
ahmad1987 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 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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900