locked
RegAsm in Custom Action RRS feed

  • Question

  • I have an Outlook Addin, that's created in Visual Studio 2010 targeting .NET Framework 4.0.

    This addin was previously written in VB6 (thus targeting only x86 Outlook).

    However, I'm running into problems now because there's 2 versions of Outlook.

    I had amended this a few years ago, but have 2 separate MSI files (one targeting x86 and one targeting x64...with respective Launch Conditions in each to prevent the user from installing an incorrect MSI on their Outlook).

    However now I'm running into bigger issues...more and more users keep downloading the incorrect version and their getting annoyed.

    I was hoping to make 1 installer files and registering the following files.

    1. Shim x86
    2. Shim x64

    I've placed these both in 1 installer file (with the installer targeting x86), and I'm running RegSvr32 on these via Custom Action by subscribing to the Commit event.

    Now the problem becomes when I have some .NET DLLs. I have basically a DLL (which is responsible for checking whether or not the registration of a user has been satisfied or not).

    For some reason, even though I make a call to the following:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe

    And also for x64 based systems:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe

    The full call to this for my activation DLL and my main DLL is the following:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /tlb MyDll.dll /Codebase

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /tlb MyDll.dll /Codebase

    The code runs successfully (at least my assumption is that it runs successfully because there are no errors thrown in the Try/Catch).

    However, when I debug through my application, and make the call to CreateObject it just returns back an error stating ActiveX Component cannot be created.

    So now, the situation becomes more convoluted (and I'm confused as well now) because when I run the commands via an elevated command prompt the code seems to work.

    So I have two major questions:

    1. Am I running the command(s) correctly in the Custom Action installer?
    2. Why does the command work via elevated command prompt (when I thought the MSI runs in elevated mode anyways?

    I can post more code if need be.

    Tuesday, June 14, 2016 10:41 PM

Answers

  • Scroll down to the Deployment heading, see if it helps, and basically there is no need to run regasm:

    https://www.simple-talk.com/dotnet/visual-studio/build-and-deploy-a-.net-com-assembly/

    And if you're using code to run regasm.exe then:

    1. Try/catch is for failures in your own code. You won't catch an error if regasm doesn't work correctly because (for example) it can't find a dependent assembly.

    2. If your code is managed code, then again, don't bother with regasm - you can just use the RestrationServices class to register the assembly.


    Phil Wilson

    Thursday, June 16, 2016 7:21 PM

All replies

  • Hi Rahul Kishore,

    This is the forum to discuss questions and feedback for Outlook for Developers, I'll move your question to the MSDN forum for ClickOnce and Setup & Deployment Projects

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winformssetup

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.
    Wednesday, June 15, 2016 1:34 AM
  • Hi Rahul Kishore,

    You could take a look at below links:

    Walkthrough: Creating a Custom Action

    Creating a setup project using Setup Project Wizard

    Regards,

    Moonlight

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 15, 2016 2:27 AM
  • Scroll down to the Deployment heading, see if it helps, and basically there is no need to run regasm:

    https://www.simple-talk.com/dotnet/visual-studio/build-and-deploy-a-.net-com-assembly/

    And if you're using code to run regasm.exe then:

    1. Try/catch is for failures in your own code. You won't catch an error if regasm doesn't work correctly because (for example) it can't find a dependent assembly.

    2. If your code is managed code, then again, don't bother with regasm - you can just use the RestrationServices class to register the assembly.


    Phil Wilson

    Thursday, June 16, 2016 7:21 PM