title: Registering COM referenced DLLs on a build server
body: <p>We're developing a C# application that references a few COM libraries (AutoIT for example).</p>
  
  <p>I am including all referenced components under source control, in a 3rd party "Libs" folder.</p>
  
  <p>The problem is that COM dll's don't have a HintPath property in the .csproj file, and i assume these must be manually registered using regsvr32 (or using a script of some sort).</p>
  
  <p>I am currently looking into creating an MSBuild script that will run before every build, however i couldn't figure out if i should be manually calling regsvr32.exe or use some predefined MSBuild task?</p>
  
  <p>Currently, this is what i've attmpted as a test:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"&gt;
    &lt;ItemGroup&gt;
      &lt;MyAssemblies Include="D:\*.dll" /&gt;
    &lt;/ItemGroup&gt;
    &lt;Target Name="Build"&gt;
      &lt;RegisterAssembly
        Assemblies="@(MyAssemblies)" &gt;
      &lt;/RegisterAssembly&gt;
    &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>This generates errors that the DLLs i've placed in the given folder are not valid DLLs.</p>
  
  <p>What is a good solution for this problem?</p>
  
  <p>EDIT:</p>
  
  <p>Projects that reference COM dlls have something similar to this in the .csproj file:</p>
  
  <pre><code>&lt;COMReference Include="AutoItX3Lib"&gt;
        &lt;Guid&gt;{F8937E53-D444-4E71-9275-35B64210CC3B}&lt;/Guid&gt;
        &lt;VersionMajor&gt;1&lt;/VersionMajor&gt;
        &lt;VersionMinor&gt;0&lt;/VersionMinor&gt;
        &lt;Lcid&gt;0&lt;/Lcid&gt;
        &lt;WrapperTool&gt;tlbimp&lt;/WrapperTool&gt;
        &lt;Isolated&gt;False&lt;/Isolated&gt;
      &lt;/COMReference&gt;
  </code></pre>
  
  <p>This does not include any hint path as other managed assemblies, so on a build server, the referenced COM dll is not found.</p>
  
  <p>When registering the COM dll on the build server using REGSVR32, the build succeeds.</p>