Custom Action - Error 1001: Could not find file myApp.InstallState

后端 未结 8 730
南笙
南笙 2021-02-01 15:22

I have tried to create a custom action for a Visual Studio Installer project to modify the permissions for a config file.

The Installer.cs is as follows:



        
相关标签:
8条回答
  • 2021-02-01 15:58

    Sometimes, "Debugger.Launch();" is put at those overwritten functions for debugging. If you build the installer with the statement there, and during your installation, a dialog will popup to ask you whether debug is needed, if you press 'cancel debugging', you'll get this error dialog. Because you added the 'Debugger.Launch()' at your function, then that function will be considered as 'missed' by installer. So, don't forget to remove it.

    0 讨论(0)
  • 2021-02-01 15:59

    You can find a solution here

    To quote:

    The problem is that the MSI infrastructure is looking for the installation state file which is usually created during the Install phase. If the custom action does not participate in the Install phase, no file is created.

    The solution is to add the custom action to both the Install and the Commit phases, although it does nothing during the install phase.

    0 讨论(0)
  • 2021-02-01 16:09

    Sometimes this happens when the installer class is not created correctly. Here is a tutorial which may help you: http://devcity.net/Articles/339/1/article.aspx

    Make sure that your custom action follows the tutorial recommendations.

    0 讨论(0)
  • 2021-02-01 16:09

    For me, the issue was as simple as just adding a closing quote around one of the textbox names in my CustomActionData string.

    I was using the "Textboxes (A)" and "Textboxes (B)" windows in the User Interface section. A has 1 box, EDITA1, where I get the path to a file, and B has 2 boxes, EDITB1 and EDITB2, for some database parameters. My CustomActionData string looked like this:

    /filepath="[EDITA1]" /host="[EDITB1] /port="[EDITB2]" 
    

    It should have been:

    /filepath="[EDITA1]" /host="[EDITB1]" /port="[EDITB2]" 
    

    (closing quote on [EDITB1])

    I used the Install override in my Installer class to get the values (i.e. string filepath = Context.Parameters["filepath"];) and used it to write them to an INI file for my app to use once installed. I put the "Primary output" under all of the phases in the Custom Actions GUI, but did nothing with the InstallerClass property (default: True) and only set the CustomActionData string on the Install one. I didn't even include override functions in my Installer class, since I was doing nothing that was custom in the other phases.

    0 讨论(0)
  • 2021-02-01 16:11

    Try setting Installer class = false instead of true in the properties for your custom action. That fixed this problem for me.

    0 讨论(0)
  • 2021-02-01 16:15

    Try installing this as in an administrator command prompt. This worked for me.!

    0 讨论(0)
提交回复
热议问题