如何建立这是分布作为一个自足的文件/实体(不安装).Net应用程序?这是、作为一个、应用程序、实体

2023-09-04 04:20:19 作者:还能孩子﹏多久﹖

目前我有一个VBScript应用程序的支持发送给客户端运行,然后客户端发回的结果HTML文件。把它放入角度来看,输出在性质上Syscomp.exe从绝对动力学类似除了我的是一个.vbs文件,也没有比较功能。

Currently I have a VBScript 'application' for support to send to clients to run, and then the client sends back an HTML file with the results. To put it into perspective, the output is similar in nature to Syscomp.exe from Absolute Dynamics except mine is a single .vbs file and there is no 'comparison' feature.

的问题:要求此支持工具都在不断变化,其范围/用途越来越大 - 太大,我发现,VBScript的再一个合适的工具。理想的情况是 - 我的新工具,将有一个机制被定制。例如,而不是我不必硬code中所有的要求,/要寻找什么,有可能是一个配置文件,如一个app.config,或者更好的,我自己的标记模式的XML文件,其中可运作为应用程序的一部分在每个客户端需要的基础。注:我需要不安装,因为这会不断地发生变化,并且安装程序将使它不太利索;我们不会要求客户安装我们发送了这一点,每一次。

The problem: requirements for this support tool are constantly changing and its scope/purpose is getting larger - too large, I am finding, for VBScript to be the right tool anymore. Ideally - my new tool would have a mechanism for being customized. For example, instead of me having to hard-code all of the requirements / what to look for, there could be a configuration file such as an App.config, or better yet, an XML file with my own markup schema, which can be shipped as part of the application on a per-client needs basis. Note: I require "no installation" because this will constantly be changing, and an installer will make it much less agile; we're not going to ask clients to install every time we send this out.

我的期望的解决方案:我需要移动到一个更通用的平台。 NET是理想的,因为我们已经是一个净商店。但如果与.net我不能拿出一个解决方案,以相同的方式分配,因为我已经是当前的VBScript(单一实体),那么我会考虑,如果他们提到的其他通用的编程框架。

my desired solution: I need to move to a more general purpose platform. .Net is ideal because we're already a .Net shop. Although if with .Net I cannot come up with a solution to distribute in the same manner as I already am with the current VBScript (a single entity), then I will consider other general purpose programming frameworks if they are mentioned.

我曾尝试:

DotNetZip,感谢Cheeso对此等问题的帮助:Running从COM $ P $ .Net应用程序pssed压缩文件。我可以用它来发布一个净EXE与之配套的DLL和一个app.config,都包裹在一个自解压ZIP。不幸的是,这并不能在Windows XP中工作,除非我失去了一些东西。编辑:确认这是Windows XP和Windows Vista中没有的,DotNetZip限制的,我需要我的解决方案,在XP的工作(许多客户都XP或Windows 2003服务器农场)

DotNetZip, thanks to Cheeso's help on this SO question: Running a .Net application from a compressed "zip" file. I was able to use this to ship a .Net EXE with supporting DLL's and an App.config, all wrapped up in a self-extracting ZIP. Unfortunately, this doesn't work in Windows XP, unless I'm missing something. confirmed this is limitation of Windows XP and Windows Vista, not of DotNetZip. I need my solution to work on XP (many clients have XP or farms of Windows 2003 Server)

7Zip的 - 不符合我的需求,因为我无法在.config文件添加到.7z档案后,我已经建我的解决方案。我能够做到将文件添加到SFX在DotNetZip创建只是通过重命名为.ZIP,添加新的.config,然后去除.zip扩展。

7Zip - does not meet my needs because I cannot add a .config to a .7z archive after I have "built" my solution. I was able to do add files to SFX's created in DotNetZip just by renaming it to ".zip", adding the new .config, then removing the .zip extension.

NBOX 将无法工作,因为任何配置文件(如应用程序的包装。配置)将需要我的构建过程的一部分。我需要,我可以简单地'下降'后生成过程中的任何一点和/外面有一个是,被运往最终产品的一部分配置

NBox will not work because the packing of any config file (e.g. app.config) would need to be part of my build process. I need a config that I can simply 'drop in' after/outside of the build process at any point and have that be part of the end product that gets shipped

咖啡杯的邮编WIZZARD 不有办法解压缩文件,但不用户干预。也不允许运行EXE后解包

Coffee Cup's Zip Wizzard Does not have a way to unpack the files without user intervention. Also doesn't allow to run an EXE post-unpack

邮编安装由NirSoft 。不符合我的要求,因为它仍然会提示最终用户那里安装文件。

Zip Installer by NirSoft. Does not meet my requirements because it still prompts the end user where to install the files.

ZIP 2安全EXE 。不幸的是,这并没有制定出任何,虽然我不记得有什么缺点是

ZIP 2 Secure EXE. Unfortunately, this didn't work out either, although I cannot recall what the shortcoming was

NAR 。这个没有工作,因为它需要安装运行。除此之外,它可能会工作了。

NAR. this didn't work because it requires an installation to be run. Other than that, it probably would work out.

的问题:

是否有可能,因为我的要求是什么?如果是这样,我在哪里开始如与第三方如上述一种,或者是一个我错过了吗? 有没有人遇到我在一个类似的情况,而是选择了一条不同的路线不是一个单一的文件/实体的应用等,并想与大家分享?

要求:

必须是一个单一的实体(如EXE或ZIP) 必须能够支持至少一个配置文件,支持DLL的等。牢靠'应用。编辑:例如,我的code建成后,它可以被压缩为一个自解压ZIP。通过XML配置任何人都可以自定义,然后重命名该.exe为.zip,砸在自己的配置,并一起发送。 必须工作在XP和前进。编辑:我们假设.NET运行库已安装(V3.5至少)

推荐答案

从根本上说,你可以不支持XP与.NET应用程序,而一些外在的东西 - XP未配备标准安装任何版本的.NET,所以你可能不得不要求用户安装.NET运行时之前,你的应用程序可以正常工作。从有利的一面,如果你使用.NET 4.0,然后当你运行该程序,它会告诉用户他们所需要的.NET 4的运行时间,而不是简单地崩溃的早期.NET应用程序一样。

Fundamentally you can't support XP with a .net application without some external "stuff" - XP does not come with any version of .net installed as standard, so you might have to require users to install .net runtimes before your app can work. On the plus side, if you use .net 4.0 then when you run the program it will tell the user they need the .net 4 runtime, rather than simply crashing as earlier .net applications did.

如果我们假设pre-安装.NET一次就OK,然后有很多选择:

If we assume that pre-installing .net once is ok, then there are many options:

您可以将所有的code到一个单一的项目,从而建立一个独立的组件文件(.exe)

You can put all your code into a single project and thus build a single standalone assembly (.exe)

另外,如果你有很多的dll,你可以使用像ILMerge的工具,它们合并成一个单一的.exe文件,你出货之前,也可以将.exe文件中嵌入的DLL数据资源,然后使用应用程序的AssemblyResolve事件让你,因为它需要由系统从资源加载DLL数据。或者嵌入的DLL数据文件,然后选择自动安装他们(它们保存到磁盘旁边的.exe或在GAC),作为你的程序做之前,它调用任何的DLL它船舶这样的第一件事

Alternatively, if you have many dlls, you can use a tool like ILMerge to merge them all into a single .exe before you ship it, or you can embed the dlls as data resources within the .exe and then use the Application's AssemblyResolve events to allow you to load the dll data from resources as it is needed by the system. Or embed the dlls as data files and then "auto install" them (save them to disk next to your .exe or in the GAC) as the first thing your program does before it makes calls to any of the dlls it ships in this way.

它的另一部分是,你的应用程序必须是独立的 - 其所需的任何设置/ preferences /资源需要成立由应用程序本身 - 例如,你可以读到preference设置从注册表和如果它不是present,使用一个默认值。如果你有一个XML配置文件,然​​后将其嵌入作为一种资源,要么直接从资源阅读,或在启动时自动安装它,这样你的应用程序是自我安装,完全自给自足的。

The other part of it is that your application must be standalone - any settings/preferences/resources needed by it need to be set up by the application itself - for example, you can read a preference setting from the registry and if it is not present, use a default value. If you have an XML config file, then embed it as a resource and either read it directly from the resources, or auto-install it on startup, so that your application is "self installing" and totally self contained.