包装一个.NET应用程序,它可以运行在计算机,而无需.NET它可以、应用程序、计算机、NET

2023-09-03 02:00:05 作者:天会黑人会变

我最近已经尝试部署没有安装.NET,它的计算机上的C#应用​​程序。

I have been recently trying to deploy a C# application on a computer that does not have .NET installed.

我知道有过的许多的在这里上StackOverflow的同一主题的问题。这里有几个人,而我读的反应都:

I know that there have been many questions around the same topic here on StackOverflow. Here are a few of them, of which I read the responses to all:

Packaging了.NET框架.NET应用程序的部署

Run无需安装.NET应用程序.NET客户端配置文件?

Run在Windows XP中的C#Windows应用程序,而无需安装.NET框架

因此​​,所有的回应上述问题的状态,这是不特定的软件是不可能的,等提到的一个软件是的火蜥蜴.NET连接器。与唯一的问题是,我似乎无法能够运行该应用程序后,它已被处理过Salamender。据我所知,这本身是不可能的,因为它需要.NET虚拟机来运行。然而,在过去,我使Java应用程序和与他们一起,我运整个JVM。出人意料的是,他们仍然工作。那么,为什么这不是上述问题重复的原因是因为我真正的问题是:

So all of the responses to the above questions state that it is impossible without specific software, etc. One software mentioned was the Salamander .NET Linker. The only problem with that is that I cannot seem to be able to run the application after it has been processed by Salamender. I understand that this in itself is impossible, as it requires the .NET virtual machine to run. However, in the past, I have made Java applications and along with them, I shipped the entire JVM. Surprisingly, they still worked. So the reason why this is not a duplicate of the above questions is because my true question is:

,我需要什么.NET框架的项目包装?如果我管理,以包所有,将放置在同一个目录中我跑允许应用程序在运行应用程序?

What items of the .NET framework would I need to package? If I do manage to package all, would placing them in the same directory as the application I'm running allow the application to run?

我找到了一个解决方案,这一点,微软.NET的Redist包。与此唯一的问题是,它有自己的一个GUI。除此之外,这将是一个完美的结合。因此,任何人都可以告诉我一两件事情:

I found one solution to this, the Microsoft .NET Redist Package. The only problem with this is that it has a GUI of its own. Aside from that, it would be a perfect fit. So, could anyone tell me one of two things:

是否有一个命令行.NET包,如果是这样,我在哪里下载?

Is there a command-line .NET package, and if so, where do I download it?

如果没有,或者这将是不切实际的话,大约,我需要从.NET安装复制的内容目录?

If there isn't, or it would be impractical to do so, approximately what directories would I need to copy from the .NET installations?

据我所知,这些文件和目录是针对特定系统的,而我的.NET安装可能无法在电脑上工作,但如果C#是像Java,那么这应该是可以实现的。是吗?大小不是一种限制,它并不重要,我是否该应用程序和它的所有文件为1GB,或者如果它是唯一的1MB。

I understand that these files and directories are system specific, and that my .NET installation may not work on your computer, but if C# is like Java, then this should be achievable. Is it? Size is not a limitation, it does not matter to me whether or not the application and all its files is 1GB, or if it is only 1MB.

如果万一有没有其他解决办法,我用的Dependency Walker 来检查我的程序的所有依赖关系。如果我要包装他们中的大多数将我的应用程序,从理论上来说,工作的?

If in case there is no other solution, I used Dependency Walker to check all the dependencies of my program. If I were to package most of them, would my application, in theory, work?

推荐答案

对于.NET,你真正的必须的只需要安装相应的.NET框架。 .NET Framework安装不包括命令行选项,允许静默安装,如:

For .NET, you really must just install the appropriate .NET framework. The .NET framework installation does include command line options to allow for silent installs, such as:

dotnetfx35.exe /q /norestart

有关命令行选项的详细信息,请参见选择3.5 和 .NET 4.0 。

For details on the command line options, see the options for 3.5 and for .NET 4.0.

话虽这么说,大多数安装包会为你在安装过程中处理这些细节。使用一个体面的安装程序会自动处理这种依赖。

That being said, most installation packages will handle these details for you as part of the installation. Using a decent installer will take care of this dependency automatically.