简体   繁体   English

安装程序C#Visual Studio 2010中的文件夹路径输入

[英]folder path input in installer c# visual studio 2010

What i need is the user to be able pick not only the installation path, but also a path where they want to put configuration files for my program. 我需要的是用户不仅可以选择安装路径,而且还可以选择他们想要为我的程序放置配置文件的路径。

At the moment i have a setup project in the same solution as the actual program (the program is an outlook 2010 add-in, but dont think that matters). 目前,我在与实际程序相同的解决方案中有一个安装项目(该程序是Outlook 2010加载项,但不要紧)。 I tried to work with custom actions using a class library but that doesnt seem to work out. 我试图使用类库处理自定义操作,但这似乎无法解决。 I have tried using different project types as Installer Class for the custom action, but none of them worked. 我曾尝试将不同的项目类型用作自定义操作的Installer类,但没有一个起作用。 I have a Windows Form with a button on it that should open a FolderBrowserDialog and put whatever folder the user chooses into a textbox. 我有一个带有按钮的Windows窗体,该窗体应该打开FolderBrowserDialog并将用户选择的任何文件夹放入文本框。 but whenever i try to do folderBrowserDialog.ShowDialog() the form freezes completely. 但是每当我尝试执行folderBrowserDialog.ShowDialog() ,表单就会完全冻结。 The FolderBrowserDialog never shows at all. FolderBrowserDialog根本不会显示。

Any help much appreciated :) 任何帮助表示赞赏:)

greets 打招呼

Since you said "any help" would be appreciated: 由于您说“任何帮助”,我们将不胜感激:

You're using a tool that is horrible. 您使用的工具太可怕了。 Microsoft removed it from VS2012 and there are 5K+ votes on user voice saying to bring it back because it "worked just fine". 微软从VS2012中删除了它,并且用户声音得到5K +的投票赞成将其恢复,因为它“工作得很好”。 Frankly, that represents 5K developers who hardly know anything about Windows Installer. 坦率地说,这代表了几乎不了解Windows Installer的5K开发人员。

The tool abstracts and seals away so much Windows Installer technology that it fails to expose, besides a great many other things, the ability to customize the Installation User Interface Sequence in the way that you need and would be otherwise possible. 该工具对很多Windows Installer技术进行了抽象和密封,以致于它无法揭示除许多其他事项之外,还可以按您需要的方式自定义安装用户界面序列的功能。

So instead you are forced to use InstallUtil custom actions to present UI in the InstallExecuteSequence where no UI is supposed to be shown. 因此,您不得不使用InstallUtil自定义操作在不应该显示任何UI的InstallExecuteSequence中显示UI。 This violates several tenants of Windows Installer design and if this was an application you were talking about you'd likely never consider doing it. 这违反了Windows Installer设计的多个租户,如果您正在谈论的是一个应用程序,则可能永远不会考虑这样做。

If you want to do it right you only have 2 choices. 如果您想正确执行操作,则只有两种选择。 Postbuild manipulate the MSI to inject what Setup and Deployment cannot (like manipulating IL in a built DLL because C# doesn't support something that the CLS does) or switch to a tool such as Windows Installer XML or InstallShield Professional that handles it properly in the first place. Postbuild会操纵MSI,以注入设置和部署无法执行的操作(例如,由于C#不支持CLS所支持的操作,而在内置DLL中操作IL),或切换到诸如Windows Installer XML或InstallShield Professional之类的工具来正确处理MSI。第一名。

I'm sure I will now be downvoted by a percentage of those 5K developers but I don't care. 我敢肯定,现在我会被那些5K开发人员的一部分所否定,但我不在乎。 I've been developing installers for 17 years and I'm the top contributor on installer related tags and I know what I speak isn't merely opinion. 我从事安装程序开发工作已有17年了,我是与安装程序相关的标签的最大贡献者,我知道我所说的不仅仅是观点。

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

相关问题 如何在 Visual Studio 2010 中为 c# 安装程序编写自定义操作? - how to write custom action for a c# installer in visual studio 2010? 在用户输入Visual Studio 2010 C#上创建新文件夹时遇到问题 - Having trouble creating a new folder on user input Visual Studio 2010 C# 程序集不移到Visual Studio C#2010项目中的bin文件夹 - Assembly not moving to bin folder in Visual Studio C# 2010 project 如何为我的 Visual Studio 2010 C# 项目制作安装程序? - How do I make an installer for my Visual Studio 2010 C# project? 如何使用Visual Studio 2010为C#Web服务项目创建.msi安装程序? - How do I create an .msi installer with Visual Studio 2010 for a C# webservices project? 在Visual Studio安装程序中更改安装路径(应用程序文件夹) - Changing the Installation Path (Application Folder) in Visual studio installer C#Visual Studio用户输入的文件路径和文件名 - C# visual studio user input for file path and file name 将多个程序打包到一个安装程序C#中(Visual 2010 Basic) - Packaging multiple programs into one installer C# (visual 2010 basic) visual studio 2010 c#单元测试 - visual studio 2010 c# unit tests 在Visual Studio 2010 C#中发布代码 - Releasing a code in visual studio 2010 C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM