1

Iam trying to create an Automation in Install Shield, But Whenever I try to create object of ISWiRelease it throws following exception.

Additional information: Retrieving the COM class factory for component with CLSID {16C4628B-361F-4739-8D75-4E8FA8C4A348} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

I tried changing target platform to x86,Still Iam getting this exception. Iam using Install Shield 2015 SP2.

DLL which I loaded is ISWiAuto22

Please help me to fix this issue.

Code:

 public void BuildProject()
        {
            ISWiProductConfigs oProdConfigs;
            ISWiProductConfig oProdConfig;
            ISWiRelease oRelease = new ISWiRelease();
            ISWiProject oISWiProj = new ISWiProject();
            try
            {

                //Create IS object
                oISWiProj.OpenProject(sProjectFileName, false);
                //oISWiProj.ProductVersion = sBuildNumber;

                oProdConfigs = oISWiProj.ISWiProductConfigs;
                oProdConfig = oProdConfigs[oProdConfigs.Count];


                oRelease = oProdConfig.ISWiReleases[1];

                oRelease.ProgressIncrement += new __ISWiRelease_ProgressIncrementEventHandler(release_ProgressIncrement);
                oRelease.StatusMessage += new __ISWiRelease_StatusMessageEventHandler(this.release_StatusMessages);

                oRelease.BuildLocation = sBuildLocation;
                oRelease.Build();

                oISWiProj.SaveProject();

                oISWiProj.CloseProject();
            }
            catch
            {
                //log("Build Failed...");
            }
            finally
            {
                oRelease.ProgressIncrement -= new __ISWiRelease_ProgressIncrementEventHandler(release_ProgressIncrement);
                oRelease.StatusMessage -= new __ISWiRelease_StatusMessageEventHandler(this.release_StatusMessages);
            }
        }
Justin CI
  • 2,693
  • 1
  • 16
  • 34
  • 1
    It looks like the kind of interface that you can't create yourself, pretty common in COM object models. The company's manual says that you need to retrieve it from the ISWiReleases collection. Which you in fact do, all you have to do is fix the declaration: `ISWiRelease oRelease = null;` Do beware that the *finally* block is risky, you keep using the interface even though you called CloseProject(). That might bomb. – Hans Passant Jun 14 '18 at 09:14
  • Thanks It worked!!!! :-) – Justin CI Jun 14 '18 at 09:19

0 Answers0