Ask a questionAsk a question
 

AnswerError building ComVisible library in TFS Build Server

  • Wednesday, October 28, 2009 10:43 PMDale At Work Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I have a solution with 24 projects that we have been building in TFS Build Server successfully for quite a while.  We just added a new project to the solution that builds a ComVisible dll containing a ComVisible class called UploadParams.  Now when we build on build server, I get the following error:

    C:\WINNT\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3019,9): error MSB3216:
     Cannot register assembly "f:\tfsbuild\Comm\STARs10Server\Binaries\Release\STAR.Common.Upload.dll" - access denied. 
    Please make sure you're running the application as administrator. 
    Access to the registry key 'HKEY_CLASSES_ROOT\STAR.Common.Upload.UploadParams' is denied.
    I need to build this dll as part of the team build but I don't need to register the dll on the build server.  How can I make it build as ComVisible while preventing the attempt to register the COM library?

    Regards,

    Dale

Answers

  • Friday, October 30, 2009 3:37 AMRuiz YiModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hi Dale,

    The Task in "C:\WINNT\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3019,9)" is

    <Target
            Name="UnmanagedRegistration"
            Condition="'$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library'"
            DependsOnTargets="$(UnmanagedRegistrationDependsOn)"
            >
    
            <RegisterAssembly
                Assemblies="@(_OutputPathItem->'%(FullPath)$(TargetFileName)')"
                TypeLibFiles="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"
                AssemblyListFile="@(_UnmanagedRegistrationCache)"
                CreateCodeBase="true"
                Condition="!Exists('@(_UnmanagedRegistrationCache)')"/>
    
            <ItemGroup>
                <FileWrites Include="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"/>
            </ItemGroup>
        </Target>
    
    It seems that you checked  RegisterForComInterop in Build Tab of Project Property Page. You can uncheck it for the Configuration and Platform used in Team Build.

    Best Regards,
    Ruiz


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi
    • Marked As Answer byDale At Work Saturday, October 31, 2009 12:17 AM
    •  

All Replies

  • Friday, October 30, 2009 3:37 AMRuiz YiModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hi Dale,

    The Task in "C:\WINNT\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3019,9)" is

    <Target
            Name="UnmanagedRegistration"
            Condition="'$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library'"
            DependsOnTargets="$(UnmanagedRegistrationDependsOn)"
            >
    
            <RegisterAssembly
                Assemblies="@(_OutputPathItem->'%(FullPath)$(TargetFileName)')"
                TypeLibFiles="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"
                AssemblyListFile="@(_UnmanagedRegistrationCache)"
                CreateCodeBase="true"
                Condition="!Exists('@(_UnmanagedRegistrationCache)')"/>
    
            <ItemGroup>
                <FileWrites Include="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"/>
            </ItemGroup>
        </Target>
    
    It seems that you checked  RegisterForComInterop in Build Tab of Project Property Page. You can uncheck it for the Configuration and Platform used in Team Build.

    Best Regards,
    Ruiz


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi
    • Marked As Answer byDale At Work Saturday, October 31, 2009 12:17 AM
    •  
  • Saturday, October 31, 2009 12:18 AMDale At Work Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you, Ruiz.  It seems so obvious now.  That fixed it.

    Dale