开发者

c# exe file example

开发者 https://www.devze.com 2023-02-21 01:10 出处:网络
Can someone give me an example of how I can create an exe file with no dependencies from a console app p开发者_Go百科roject?

Can someone give me an example of how I can create an exe file with no dependencies from a console app p开发者_Go百科roject?

I know that in bin/debug I will have the exe file after compiling my code. I would like to know how can i make an exe that will run on every computer without the need to install Visual Studio (or any other dependency: eg .net framework) on that particular computer. Is it possible?

Is there a better way to create .exe files that run on every computer?


The user doesn't have to install Visual Studio in order to use an app built in C#. They do have to have the .NET framework installed, however.

Modern versions of Windows have come with .NET preinstalled for a while, and they've been part of Windows update, too - obviously the earlier the version of .NET you target, the more computers you're likely to be able to run on. I expect that targeting .NET 2.0 should give pretty good coverage, although that way you miss the goodies from LINQ etc.

While there are "native" compilers for .NET, I don't know of any mainstream ones... the Mono AOT is probably the closest to mainstream, but I haven't used it myself.


If you write it c# the machines you need will need .net on.

Only way to write apps that dont is either, to investigate specialised packaging tools that will install and take the bits of .net you need with it, or, write a native app


You will need at least the compiler to produce an executable.


You have two options to create a windows application (an exe):

  • Managed .NET applications: You don't need VS in the target machine but you need de .NET runtime. You can include it making an installation package or just include the url for your users to install it manually.
  • Native applications: They run in any Windows computer but are harder to develop. Typically you have to use C/C++ instead of C#/.NET.


In the bin folder (debug or release - it depends on your compilation configuration) you have compiled program that you can take (will all dll's that are in this folder) to another computer. Because you use C# (and generally .Net) as you programming language to run this program .Net framework has to be installed on the machine you want to use this app - this is requirement.


On every machine? Do u mean pc (windows, linux, unix), mac etc? U have to use multiplatfor leangue like Java orac C/C++.

0

精彩评论

暂无评论...
验证码 换一张
取 消