简体   繁体   English

如何在安装过程中一次写入配置文件

[英]how to write in config file once during installation

I have some variables that I need to set once while installing. 我有一些安装时需要设置一次的变量。 For example I need to set COM port, registration of the vehicle and so on... 例如,我需要设置COM端口,车辆注册等等。

How to write to config file during installation once and only read it always after. 如何在安装过程中一次写入配置文件,然后仅在之后始终读取它。 Is there any custom installation tool. 是否有任何自定义安装工具。 I have looked at WinX and I must say that I was not so pleased. 我看过WinX,我必须说我不是很高兴。

Thank you. 谢谢。

Just make a new form like SplashScreen and do ur initialisation in app.config, add a new variable named fInstalled in app.config and change its value to true. 只需创建一个新的表格(如SplashScreen),然后在app.config中进行初始化,在app.config中添加一个名为fInstalled的新变量,并将其值更改为true。

Now where ever you start your application check whether fInstalled is true, if it is false go to your MainForm else reconfigure using splashscreen. 现在,无论您在哪里启动应用程序,请检查fInstalled是否为true,如果为false,请转到MainForm,否则使用启动屏幕重新配置。

SplashScreen is just an example or u can also do without splash screen. SplashScreen只是一个示例,或者您也可以不使用启动画面。

Its recommended to use NSIS 建议使用NSIS

with it you can manipulate XML config file during installation. 有了它,您可以在安装过程中处理XML配置文件。

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

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