Help creating a installer using Wix

Add-in Express™ Support Service
That's what is more important than anything else

Help creating a installer using Wix
 
vilhena




Posts: 14
Joined: 2014-03-30
Hello,

When I try creating a setup project for my addin using Wix using the Addin Express wizard (MyAddinProject>Addin Express>Create Setup Project) an error is thrown (see details below). Can anybody please help me fix this error?

Detailed technical information follows:
---
Date and Time: ...
Machine Name: ...
IP Address: ...
Current User: ...

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Program Files (x86)/Add-in Express/Add-in Express for .NET/Bin/Packages/VS2005/AddinExpress.Wizard.dll
Assembly Full Name: AddinExpress.Wizard, Version=8.1.4350.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.1.4350.0

Exception Source: AddinExpress.Wizard
Exception Type: System.Exception
Exception Message: Exception has been thrown by the target of an invocation.
Exception Target Site: ExamineAssembly

---- Stack Trace ----
AddinExpress.Projects.Common.Utilities.ExamineAssembly(scanDependencies As Boolean, assemblyfile As String, handle As Int32, processor As String&, version As String&, publicToken As String&, culture As String&, dependencies As String&, appName As String&, publisher As String&, apps As Int32&, imageRuntimeVersion As String&)
AddinExpress.Wizard.dll: N 0185 (0xB9) IL
AddinExpress.SetupWizard.SetupWizardForm.CreateSetupProject(primaryOutputPath As String)
AddinExpress.Wizard.dll: N 2579 (0xA13) IL
AddinExpress.SetupWizard.SetupWizardForm.CreateSetupProject(project As Project, targetFramework As UInt32, serviceProvider As IServiceProvider)
AddinExpress.Wizard.dll: N 0055 (0x37) IL
AddinExpress.Wizard.ADXPackage.Exec(guidCmdGroup As Guid&, cmdID As UInt32, nCmdexecopt As UInt32, pvaIn As IntPtr, pvaOut As IntPtr)
AddinExpress.Wizard.dll: N 0995 (0x3E3) IL


Regards,
Felipe
Posted 01 May, 2016 16:52:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hello,

Did you add any custom code to the add-in constructor?
Posted 02 May, 2016 04:07:31 Top
vilhena




Posts: 14
Joined: 2014-03-30
Hi Sergey,

I?Â?Ð?ém not sure what you mean by custom code to the add-in constructor. My solution has three projects and two of them are built before the add-in project, but I?Â?Ð?éve setup this using only the Visual Studio standard features. Besides, I have successfully created a .vdproj setup project without any warnings.
Posted 02 May, 2016 08:56:07 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Vilhena,

When you create a Wix setup project, Add-in Express creates an instance of your add-in. I guess that the constructor of the add-in produces the exception. The exception may also be generated by a component that is initialized in the InitializeComponent method of the addinmodule. Please review the code of the AddinModule class.
Posted 03 May, 2016 03:54:07 Top
vilhena




Posts: 14
Joined: 2014-03-30
Sergey,

When my add-in initializes I run some code to check if the user has a valid license and if not I disable it using the method suggested by add-in express team. The license is checked using a third part component. I will run some tests and I let you know.
Posted 03 May, 2016 09:05:35 Top
vilhena




Posts: 14
Joined: 2014-03-30
Sergey,

I've disabled the license checking and the error still remains. The InitializeComponent method just contains designer generated code. I've created a new COM add-in sample project and the Wix setup project worked properly. Do you have any other ideas?
Posted 03 May, 2016 18:55:58 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Felipe,

Please make sure that you have no custom code in the constructor of the add-in module; move all such code to the AddinInitialize or OnRibbonBeforeCreate event of the add-in module. Similarly, if there are initializers for complex-type variables declared on the add-in module's class level, move the initialization of this sort to the same event.

E.g. replace this code :

    public partial class AddinModule : AddinExpress.MSO.ADXAddinModule
    {
        MyType myVar = null;

        public AddinModule()
        {
            Application.EnableVisualStyles();
            InitializeComponent();
            // Please add any initialization code to the AddinInitialize event handler
        }


with this:

    public partial class AddinModule : AddinExpress.MSO.ADXAddinModule
    {
        MyType myVar;

        public AddinModule()
        {
            Application.EnableVisualStyles();
            InitializeComponent();
            // Please add any initialization code to the AddinInitialize event handler
        }
        private void AddinModule_AddinInitialize(object sender, EventArgs e) {
            myVar = null;
        }



Andrei Smolin
Add-in Express Team Leader‎
Posted 04 May, 2016 03:52:53 Top
vilhena




Posts: 14
Joined: 2014-03-30
Thank you for your valuable help, Andrei and Sergey! As you said, the problem was in the initialization of the add-in. I figured out that error was due to the license check dll that wasn?Â?Ð?ét referenced in my project, i.e., called directly by a DllImport statement. This was preventing the add-in to be unregistered.

Regards,
Felipe
Posted 04 May, 2016 19:56:38 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
You are welcome!


Andrei Smolin
Add-in Express Team Leader‎
Posted 05 May, 2016 01:07:51 Top