简体   繁体   English

如何使用GAC和NGEN部署C#应用程序

[英]HOW to deploy C# application with GAC and NGEN

I have small C# tool, compiled as Windows Application which goal is to wrap execution of other tools. 我有一个小的C#工具,被编译为Windows应用程序,目的是包装其他工具的执行。 This tool will be executed frequently, sometimes a 100 times a second and this is what I cannot change; 该工具将频繁执行,有时每秒执行100次,这是我无法更改的。 same as this will work with Framework 2. Most important for this tool will be short warm startup. 与框架2相同。此工具最重要的是短暂的热启动。

Using Visual Studio 2013 I signed my assembly with strong name key. 使用Visual Studio 2013,我使用强名称密钥对程序集进行了签名。 Compiled "Release" and got "EXE" file. 编译“发行”并获得“ EXE”文件。 Next I ran ngen /install app.exe 接下来,我运行ngen / install app.exe

And this is all I could understand from a million posts here and out there. 这就是我从无处不在的一百万个帖子中所能理解的。 Now I need to move this app.exe to my 12 servers and I have no idea if I should just ngen install on each machine, or should also copy my DEV windows/assembly folder structure to server windows/assembly (of course my application parts only). 现在我需要将此app.exe移到我的12台服务器上,我不知道我是否应该仅在每台计算机上进行ngen安装,还是应该将DEV Windows / assembly文件夹结构复制到服务器Windows / assembly(当然,我的应用程序部件只要)。

I did ngen install on one server, but I don't see assembly created, so need help for more advanced heads. 我没有在一台服务器上安装ngen,但没有看到程序集创建,因此需要帮助来获得更高级的头。

Thanks Pawel. 谢谢帕维尔。

UPDATE: I checked again and I found assembly in x64. 更新:我再次检查,发现在x64中具有程序集。 So is it really enough to run ngen only? 那么仅运行ngen真的足够吗?

RECAP: I copied exe to server did ngen install, checked that assembly is created. 回顾:我将exe复制到ngen安装的服务器上,检查是否创建了程序集。 I run machine to launch exe 500 items - they all finished in 1 minute 24 seconds (from mutex log). 我运行计算机来启动exe 500项-它们都在1分24秒内完成(来自互斥锁日志)。 I repeated test and got exactly the same result: 1.24 Next I did ngen uninstall and checked that assembly is deleted, it was. 我重复测试并得到完全相同的结果:1.24接下来,我进行了ngen卸载并检查程序集是否已删除。 I run the same test and result was 1.26 (lol). 我运行相同的测试,结果是1.26(lol)。 Considering fact that it is stable and execution time is fully satisfactory for me I think I will give it up and stop researching to use GAC/NGEN. 考虑到它稳定且执行时间对我来说完全令人满意的事实,我想我会放弃并停止研究使用GAC / NGEN。 But any comments to this scenario and my original question are appreciated. 但是,对此方案和我的原始问题的任何评论均表示赞赏。

You should deploy all the assemblies your application needs to function to the new machine. 您应该将应用程序需要运行的所有程序集部署到新计算机上。 Then you can NGEN if you want. 然后,如果需要,您可以使用NGEN。 An installer like WiX can do both for you. 像WiX这样的安装程序可以为您完成这两项工作。 See here . 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM