English 中文(简体)
Custom Action in Deployment Project - prompt user for values, and then extract them from custom actions?
原标题:

I am building a Windows Service which will be deployed on four servers. My user wants to have the service read a configuration file from a common location, and load it OnStart.

I want the installation to prompt the user for the file path and file name to the configuration file when the service is installed, and then save that data in My.Settings.

I have figured out how to set the EDITA1 and EDITA2 variables in the Deployment project s UI, so that the user will be prompted for path and file name, but I don t know how to get those values out and into the settings of the service.

Help, please.

-Jennifer

问题回答

Did you try passing it to the custom action using CustomActionData Property in the Custom Action property window. syntax is /param=[EDITA1]

Context.Parameters will contain a dictionary with 1 entry key being "param" (in my example above that s the key I gave it).

I m having a problem with passing in parameters which contain spaces. the guidelines say:

For custom actions that are installation components (ProjectInstaller classes), the CustomActionData property takes a format of /name=value. Multiple values must be separated by a single space: /name1=value1 /name2=value2.

If the value has a space in it, it must be surrounded by quotes: /name="a value". Windows Installer properties can be passed using the bracketed syntax: /name=[PROPERTYNAME].

For Windows Installer properties such as [TARGETDIR] that return a directory, in addition to the brackets you must include quotes and a trailing backslash: /name="[TARGETDIR]".

When I try the "[EDITA1]" for the file path I need.. I get the FileNotFound error for "C..Microsoft..." while my path didn t have Microsoft





相关问题
WIX C++ Custom Action

I have a basic WIX custom action: UINT __stdcall MyCustomAction(MSIHANDLE hInstaller) { DWORD dwSize=0; MsiGetProperty(hInstaller, TEXT("MyProperty"), TEXT("...

Execute a .exe file automatically after installation

I have a .exe file, which should be executed as soon as the installation of the main application is finished. I understand this can be achieved using Custom action. I need a little assistance in ...

Empty setup project in Visual Studio 2008

I have a ClickOnce installation I want to distribute. Some system administrators prefer a MSI installation package which, when run, installs the ClickOnce application. I ve created a Visual Studio ...

ASP.NET MVC Pass object from Custom Action Filter to Action

If I create an object in a Custom Action Filter in ASP.NET MVC in public override void OnActionExecuting(ActionExecutingContext filterContext) { DetachedCriteria criteria = DetachedCriteria.For&...

热门标签