5

I have seen many solutions for automating my InstallShield build, but I am having issues with each one. I am using InstallShield Professional 2013. Sorry for the lengthy question, but I am clueless on which direction to go to solve my issues.

1) IsCmdBld.exe - I have a script that runs and will build my installer. BUT, when the installer runs, I get an error message that says "The System Administrator has set policies to prevent this installation". I am not sure why this is happening, but I do not get the same error message if I build the installer through the designer. EDIT: Here is my command (%guid% is a Guid I generate to set the Product Code):

for /f %%i in ('"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\uuidgen.exe"') do set guid=%%i

"C:\Program Files (x86)\InstallShield\2013 SP1 SAB\System\ISCmdBld.exe" -p "MyInstaller.ism" -r SingleImage -y "1.0.0.13" -z ProductCode=%guid%

2) InstallShield Automation Interface - I have followed numerous examples and tutorials on this, but all end in the same result. When I call the following code:

     var project = new ISWiAuto20.ISWiProject();

I get this error:

Unable to cast COM object of type 'System.__ComObject' to interface type 
'ISWiAuto20.ISWiProject'. This operation failed because the QueryInterface call 
on the COM component for the interface with IID '{872D23A7-C18D-468C-895D-1CF027E4FBB1}' 
failed due to the following error: Library not registered. 
(Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

3) MsBuild.exe - Running MsBuild on my InstallShield project file yields this error:

error NSB4025: The project file could not be loaded. Invalid character in the 
   given encoding. Line 1, position 1
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
gwin003
  • 7,432
  • 5
  • 38
  • 59
  • 1) can you show the options you use 2) can you try with `IswiAuto19.ISWiProject()` 3) an ism is binary so there's no way MsBuild can run that – stijn Oct 10 '13 at 08:54
  • @stinj I edited my answer to show the options I am using. Also I do not have `IswiAuto19` because I am using installshield 2013, which is version 20. – gwin003 Oct 10 '13 at 11:26
  • Tell me more about your existing build automation system. Are you starting from scratch or do you already have automation in place for other parts of your system. BuildForge, TFS, Jenkins? Nant, MSBuild, Perl, Bat? Nothing? There are many ways to automate InstallShield builds to support the many different systems customers might have in place. – Christopher Painter Oct 10 '13 at 12:35
  • @ChristopherPainter Currently using TeamCity as out CI/build server. I am trying to useIsCmdBld because it would work best with TeamCity IMO. – gwin003 Oct 10 '13 at 12:38
  • TeamCity has excellent MSBuild support via the MSBuild runner. But if you don't currently have anything invested in MSBuild and don't already know it, there is nothing "wrong" with calling ISCmdBld. But otherwise I disagree that it works "best". – Christopher Painter Oct 10 '13 at 13:16
  • @ChristopherPainter maybe "best" wasnt the correct word, but I am unsure how to compile the installer using MsBuild. I have a VB project that will build the installer when it runs but not when it builds. – gwin003 Oct 10 '13 at 14:22

2 Answers2

5

The choice between these approaches (when they all work) largely depends on the build system you are trying to integrate with. If you're using a batch or makefile approach, IsCmdBld.exe is probably the easiest starting point. If you're using Visual Studio and TFS or MSBuild, you'll probably have more luck there, as it will report errors in a way the build system can understand. (Other than that, they're fundamentally similar.) If you need to make tweaks to the project before you build it, the automation layer can either augment or replace the other approaches.

But in your case you say they all don't work. What have you done to diagnose why? Here are the first steps I'd take for each of those symptoms:

  • IsCmdBuild built setups yielding an error that the IDE-build ones do not. First identify what the problem really is. Look in a verbose log for more information. Build both ways with the .msi available and compare the results with MsiDiff. Make sure you've tested elevated. Depending on what you find, it may be something to address in the project, the build process, or a bug in InstallShield.
  • Automation Interface yields TYPE_E_LIBNOTREGISTERED. First off, if this is the IDE machine, consider repairing the installation. If it's a standalone-build machine, ditto. If it's a standalone-build machine that didn't use the installation, you should, or at least you should ensure the dependencies are present and that the automation interface is registered. Secondly, as Christopher Painter noted, InstallShield is a 32-bit product so it must be invoked from a 32-bit context. If you're calling, say, CScript to run a .vbs file, make sure you're using C:\Windows\SysWow64\CScript.exe.
  • MSBuild NSB4025. The comment from stijn is largely correct - you can't call MSBuild on the .ism file (while it can be xml instead of binary, it's not MSBuild-compatible). However you can create a .isproj file that can work correctly. Save the project in Visual Studio, or copy <InstallShield>\Support\0409\MSBuild.xml to (ProjectName).isproj and tweak its contents; call MSBuild on the resulting .isproj file. Odds are strong this will have approximately the same results as IsCmdBuild, as the build portion is largely shared.
Michael Urman
  • 15,737
  • 2
  • 28
  • 44
  • 2
    Unless 2013 has changed, previous versions of InstallShield has required to be run in a 32bit process due to the COM objects. If I'm using MSBuild via TFS I have to select x86 MSBuild or otherwise I'll get COM exceptions. – Christopher Painter Oct 10 '13 at 12:37
  • 1
    Thanks for the response, but I believe I have discovered the solution to all of my problems. When I am automating the build, I have been updating the Product Code. Apparently IS needs the Product Code in a `{guid_goes_here}` format, and I was not putting the curly braces in place. +1 for the insight and guidance. – gwin003 Oct 10 '13 at 12:41
0

Using MSBuild doesn't follow the exact order of the Project files specified in the solution .sln file.

The best option is to use devenv.exe

And sometimes, devenv doesn't return exact return status, so I kept an exe to scan the log file for the success code.

https://devopsdiaryblog.wordpress.com/2017/12/20/devenv-return-code-issue/

And for iscmdbuild.exe, better to use commandline as it is the suggested one from flexera.

encrypted name
  • 149
  • 3
  • 17