简体   繁体   English

c#Visual Studio Project安装程序从文本框中检索数据

[英]c# Visual Studio Project Installer retrieve data from Textbox

I'm trying to retrieve data from a Textbox in Visual Studio Project Installer but I simply keep failing. 我正在尝试从Visual Studio Project Installer中的文本框检索数据,但我一直失败。 I have no idea how to retrieve data from, let's say the EDITA2 field and it seems the internet has no answers so far. 我不知道如何从EDITA2字段中检索数据,到目前为止,互联网似乎没有任何答案。

The project I'm talking about is a windows service you install with the mentioned installer. 我正在谈论的项目是您使用上述安装程序安装的Windows服务。 In the installer you can configure the service. 在安装程序中,您可以配置服务。 I want to get data like server IPs and computer names and I want to use this data later in the running service. 我想获取诸如服务器IP和计算机名称之类的数据,并希望稍后在运行的服务中使用此数据。 Talking of service, is there a possibility to automatically start the service after installation? 谈到服务,安装后是否有可能自动启动服务?

Summing up, i want to write data from the installer to a text file and to start a batch file after the installation process is completet. 总结一下,我想将安装程序中的数据写入文本文件,并在安装过程完成后启动批处理文件。 Can you help me please? 你能帮我吗?

Thanks in advance for an answer. 预先感谢您的答复。

This is the documentation for the Textboxes user interface dialog: 这是“文本框”用户界面对话框的文档:

https://msdn.microsoft.com/en-us/library/e04k6f53(v=vs.100).aspx https://msdn.microsoft.com/en-us/library/e04k6f53(v=vs.100).aspx

The identifier EDITA1 (and others) is a property name that you can use later in (for example) custom actions. 标识符EDITA1(和其他标识符)是一个属性名称,您以后可以在(例如)自定义操作中使用它。 Without knowing exactly what kind of custom action you might be thinking of it's hard to say how you use it. 在不知道确切的自定义操作类型的情况下,您可能很难想到如何使用它。 In general, specifying it as a parameter to the custom action as [EDITA1] will cause it to be resolved to its actual value. 通常,将其指定为自定义操作的参数[EDITA1]将导致其解析为实际值。 But if you just want to store the values in the registry you'd create a registry item with the value [EDITA1]. 但是,如果您只想将值存储在注册表中,则可以使用值[EDITA1]创建一个注册表项。

To start the service in Visual Studio setups that install services with installer classes you'd need to overwrite the Install method, calling base.Install() and then adding code to start the service. 要在使用安装程序类安装服务的Visual Studio安装程序中启动服务,您需要覆盖Install方法,调用base.Install(),然后添加代码以启动服务。 Similarly at uninstall or upgrade time you can override the Uninstall method and stop the service before calling base.Uninstall(). 同样,在卸载或升级时,您可以覆盖Uninstall方法并在调用base.Uninstall()之前停止服务。

These posts have some Textboxes examples: 这些帖子有一些“文本框”示例:

Overriding "Textboxes" dialog fields from the command line in MSI installer (Visual Studio 2010 Web Setup) 在MSI安装程序中从命令行覆盖“文本框”对话框字段(Visual Studio 2010 Web安装程序)

Setup Project: user enters a value then store it in a text file or database 设置项目:用户输入一个值,然后将其存储在文本文件或数据库中

Visual Studio setups are not very useful with services and UI. Visual Studio设置对于服务和UI并不是很有用。 There is no way to validate what the user enters at the time it is entered - if you validate it with a custom action it will be at the end of the install and the entire install will fail and roll back. 无法在输入时验证用户输入的内容-如果使用自定义操作验证用户输入的内容,则该操作将在安装结束时进行,并且整个安装将失败并回滚。 Windows Installer has built-in support to start/stop/delete/install services but VS setups don't use it. Windows Installer内置了对启动/停止/删除/安装服务的支持,但是VS安装程序不使用它。 If this is something you do regularly it might be useful to consider another tool, and that might have a learning curve but the resulting MSI will be more reliable and easier to use. 如果您定期执行此操作,则考虑使用其他工具可能会很有用,并且该工具可能会有所学习,但是生成的MSI将更加可靠且易于使用。

暂无
暂无

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

相关问题 c#Visual Studio Project安装程序将文本框中的数据保存到文本文件中 - c# Visual Studio Project Installer save data from Textbox into Textfile C#Visual Studio安装程序设置项目输出为一个.exe - c# visual studio installer setup project output as one .exe Visual Studio 2017 C#安装程序项目未安装我的应用程序 - Visual Studio 2017 C# installer project is not installing my app 如何从Visual Studio 2013 C#项目的安装程序中获取变量? - How can I obtain a variable from the installer of a visual studio 2013 c# project? 在Visual Studio 2015中通​​过C#在文本框中显示XML数据 - Displaying XML data in textbox through C# in Visual Studio 2015 如何在文本框中显示从串行端口接收的数据而文本不会在Visual Studio C#中消失? - How to display data received from serial port in a textbox without the text disappearing in Visual Studio C#? 在 C# Visual Studio 上的文本框中添加要选择的范围 - Adding a range to select from in textbox on C# Visual Studio 如何使用wixsharp为Visual Studio C#WPF项目创建安装程序 - How to create an installer for Visual Studio C# WPF project using wixsharp 如何使用Visual Studio 2010为C#Web服务项目创建.msi安装程序? - How do I create an .msi installer with Visual Studio 2010 for a C# webservices project? Visual Studio和安装程序项目(c#),不会复制“第三方” dll(vb) - Visual Studio and installer project (c#), won't copy a “third party” dll (vb)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM