.NET应用程序的NSIS安装项目 [英] NSIS Setup project for .NET application
问题描述
我最近在C#.NET中开发了一个应用程序,现在我必须创建相应的设置。我需要在设置阶段实现一个特定的逻辑,因此我选择使用NSIS。特别是我需要在我的应用程序的.config文件中写一些信息。我试图使用基于我在这里找到的nsisXML.dll的宏: http://nsis.sourceforge .net / Talk:NsisXML_plug-in_%28by_Wizou%29 [ ^ ],但它不起作用!
编译器没有给出任何错误,但是当我启动设置时获取Windows消息:Setup.exe已停止工作 - Windows正在检查问题的解决方案......
所以我不知道可能是什么导致错误!!
如果有人使用NSIS在.config文件中写入不同的解决方案,我将很高兴看到它。谢谢!
I have recently developed an application in C# .NET and now I have to create the corresponding setup. I need to implement a specific logic during the setup phase and for this reason I chose to use NSIS. In particular I need to write some information in the .config file of my application. I have tried to use a macro based on nsisXML.dll that I found here: http://nsis.sourceforge.net/Talk:NsisXML_plug-in_%28by_Wizou%29[^], but it doesn't work!
The compiler doesn't give any error, but when I launch the setup I obtain a Windows message: "Setup.exe has stopped working - Windows is checking for a solution to the proble..."
So I don't know what may cause the error!!
If someone has a different solution to write in a .config file with NSIS, I will be pleased to read it. Thanks!!
推荐答案
如果您使用.net语言创建config程序而不是在NSIS中编写脚本,您会发现它更容易,更易于维护。 />
您可以使用ExecWait
You would find it easier and more maintainable if you create your "config" program in a .net language instead of writing scripts in NSIS.
You can start this config program after the copy process at the end of installation script usingExecWait
<在安装脚本结束时的复制过程后启动此配置程序br />
最后我决定按照建议编写C#代码来管理配置文件。
所以我用C#编写了一个.dll然后我在我的NSIS中用它作为ReserveFile脚本,使用CLR NSIS( http://nsis.sourceforge.net/Call_.NET_DLL_methods_plug-in [ ^ ])插件,允许调用托管中的方法。 NET DLL。
所以我在NSIS脚本中用随后的代码编写了一个函数:
Eventually I have decided to follow the advice to write C# code to manage the config file.
So I wrote a .dll in C# and then I used it as ReserveFile in my NSIS script, using CLR NSIS (http://nsis.sourceforge.net/Call_.NET_DLL_methods_plug-in[^]) plug-in which allows to call methods in a managed .NET DLL.
So I wrote a function in the NSIS script with the subsequent code:
Function WriteConfig
InitPluginsDir
SetOutPath "
{ NSISDIR } \Plugins \
文件
{NSISDIR}\Plugins\" File "
这篇关于.NET应用程序的NSIS安装项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!