构建服务器上注册COM DLL的引用 [英] Registering COM referenced DLLs on a build server

查看:190
本文介绍了构建服务器上注册COM DLL的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发引用了一些COM库C#应用程序(AutoIt的举例)。

We're developing a C# application that references a few COM libraries (AutoIT for example).

我包括源代码控制下的所有引用的组件,在第3党的利布斯文件夹中。

I am including all referenced components under source control, in a 3rd party "Libs" folder.

问题是,COM DLL的没有在.csproj的文件HintPath属性,我认为这些使用REGSVR32必须手动注册(或使用某种类型的脚本)。

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).

我目前正在研究建立一个MSBuild脚本,将每一个构建之前运行,但我不能,如果我弄明白要手动调用regsvr32.exe的或者使用一些预定义的MSBuild任务

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?

目前,这就是我attmpted作为一个测试:

Currently, this is what i've attmpted as a test:

 <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
  <ItemGroup>
    <MyAssemblies Include="D:\*.dll" />
  </ItemGroup>
  <Target Name="Build">
    <RegisterAssembly
      Assemblies="@(MyAssemblies)" >
    </RegisterAssembly>
  </Target>
</Project>

这生成错误,我已经放置在指定的文件夹中的DLL文件是无效的DLL。

This generates errors that the DLLs i've placed in the given folder are not valid DLLs.

什么是这个问题的一个很好的解决方案。

What is a good solution for this problem?

编辑:

引用COM DLL文件必须在.csproj的文件类似于这样的项目:

Projects that reference COM dlls have something similar to this in the .csproj file:

<COMReference Include="AutoItX3Lib">
      <Guid>{F8937E53-D444-4E71-9275-35B64210CC3B}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
    </COMReference>

这不包括任何暗示路径等管理组件,因此构建服务器,所引用的COM上DLL是找不到的。

This does not include any hint path as other managed assemblies, so on a build server, the referenced COM dll is not found.

在使用REGSVR32注册构建服务器上的COM DLL,构建成功。

When registering the COM dll on the build server using REGSVR32, the build succeeds.

推荐答案

您不要在构建服务器上注册COM服务器。当你真正想要的运行编译后的代码,这只是必需的。你需要的是对COM服务器类型库,让你可以互操作程序集。您与Tlbimp.exe将创建。

You don't register COM servers on a build server. That's only required when you actually want to run the compiled code. What you need is the type libraries for the COM servers so you can get the interop assemblies. Which you create with Tlbimp.exe.

无论你是想构建服务器或一个dev的机器上运行前TLBIMP取决于你如何部署这些COM很大服务器。保持COM可执行文件和.TLB文件非常接近的拷贝到你的互操作库是一个好主意。换句话说,检查它们。安装程序现在可以检索COM服务器的一个已知良好版本。

Whether you want to run Tlbimp on the build server or up front on a dev machine depends a great deal on how you deploy these COM servers. Keeping a copy of the COM executables and .tlb files very close to your interop libraries is a good idea. In other words, check them in. The installer can now retrieve a known-good version of the COM server as well.

这篇关于构建服务器上注册COM DLL的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆