Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Problem with vsdrfCOMSelfReg and multiple Primary Outputs (VS2005)

Unanswered Problem with vsdrfCOMSelfReg and multiple Primary Outputs (VS2005)

  • Thursday, December 21, 2006 10:20 AM
     
     

    I'm encountering the following problem:

    I have two projects in my VS Solution (well, actually I have about 30 interdependent projects in the Solution, but I'm trying to keep it simple!):

    The first project,  MYAX, is a C++ ActiveX control library project (which builds the library MYAX.dll).

    The second project, MYAXMSM, is a deployment project, that builds a merge module from a number of sources , one of which is the project output ("primary output") of the MYAX project.

    In MYAXMSM, the properties of the Project Output for MYAX are set to vsdrfCOMSelfReg -- because MYAX is a self-registering COM library.

    Up until recently, everything was working fine, until I decided to enhance MYAX with the following custom build rule:

    <Tool
        Name="VCCustomBuildTool"
        Description="Generating .NET assemblies from type library..."
        CommandLine="aximp $(TargetDir)$(InputName).tlb /out:$(ProjectDir) Ax$(InputName)Lib.dll"
        AdditionalDependencies="$(TargetDir)$(InputName).tlb"
        Outputs="$(ProjectDir)Ax$(InputName)Lib.dll;$(ProjectDir)$(InputName)Lib.dll"
       />

    This rule builds AxMYAXLib.dll and MYAXLib.dll, which are two COM interop dlls that are are referenced by other C# and VB.NET projects in my Solution.

    The trouble is, adding this custom build rule adds these two dll files to the Primary Output of the project.  So when I view the "Outputs" list of the "Primary Output from MYAX (Active)" I see

    MYAX.dll
    MYAXLib.dll
    AxMYAXLib.dll

    Only one of these files is self-registering, namely MYAX.dll.  So attemping to build MYAXMSM results in the following error:

    ------ Starting pre-build validation for project 'MYAXMSM' ------

    ERROR: The assembly 'MYAXLib.dll' in project output group 'Primary Output from MYAX (Active)' cannot be self-registered.

    ERROR: The assembly 'AxMYAXLib.dll' in project output group 'Primary Output from MYAX (Active)' cannot be self-registered.

    And NO, the obvious work-around, adding an ExcludeFilter,  doesn't work:

    Even if I add a rule to exclude *Lib.dll, which excludes the two offending files,  the pre-build validation STILL fails. It ignores the Exclude Filter, and gives me the same error.

    The current work-around I'm using is far from satistfactory:  Instead of adding the Primary Output of MYAX, I'm adding MYAX.dll file itself instead.  This is unsatisfactory (and leads to a lot of horrible versioning issues), because I'm using a number of build configurations for different clients, and there are a number of MYAX.dll's on my hard drive. So I have to continually manually remove and add the correct one.

    To sum up:

     I want the merge module deployment project to pick out and self-register the correct version of MYAX.dll, depending on the current solution configuration, but the obvious way of doing this (adding the Primary Output of the MYAX project) doesn't work because the pre-build validation fails due to some of the files in the Output of the project are not self-registering, EVEN if I filter out those files using ExcludeFilter.

    Can anyone suggest a way round this issue? 



All Replies

  • Thursday, December 21, 2006 1:53 PM
     
     
    As C++ projects are not currently built using MSBuild, you are likely to get better responses in a C++ forum, e.g. http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=29&SiteID=1
  • Thursday, December 21, 2006 2:32 PM
     
     

    Ok, I'll try there too.  But surely this is a Visual Studio Build Engine issue I've described?