Can I read AssemblyFile information in Inno Setup

后端 未结 2 410
余生分开走
余生分开走 2021-01-05 10:45

I would like to read these three values from my application.exe in my Inno Setup script.

[assembly: AssemblyCompany(\"My Company\")]
[assembly: AssemblyProdu         


        
相关标签:
2条回答
  • 2021-01-05 11:12

    I dont know Inno Setup but I guess it supports custom actions like the other setup tools (Visual Studio, Wix, InstallShield or Wise).

    So, you will need to create a custom action to read this information from the assembly. In your custom action, you need to add the following code to fetch the assembly attributes:

    Assembly assembly  = Assembly.LoadFrom (@"path\to\greatapp.exe");
    object[] attributes = assembly.GetCustomAttributes(true);
    
    if (attributes.Length > 0)
    {
        foreach (object o in attibutes) 
        {
            //Do Something with the attribute
        }
    }
    
    0 讨论(0)
  • 2021-01-05 11:18

    Use the GetStringFileInfo() function provided by the Inno Setup Preprocessor (ISPP) as follows:

    1. GetStringFileInfo("path/to/greatapp.exe", "CompanyName")
    2. GetStringFileInfo("path/to/greatapp.exe", "ProductName")
    3. GetStringFileInfo("path/to/greatapp.exe", "FileVersion")

    As you have already mentioned, you can use the GetFileVersion() function instead of #3 above.

    Also, have a look at the ISPPBuiltins.iss script file included with your Inno Setup installation. It contains a GetFileCompany() function to use instead of #1 above and you can implement #2 above in a similar fashion.

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