如何为C#项目生成.tlh文件。

huangapple go评论81阅读模式
英文:

How to generate .tlh file for the C# project

问题

如何生成用于C++项目的C#项目的.tlh文件。 请帮助我。

英文:

How to generate .tlh file for C# project which can be used by C++ Projects. Please help me

答案1

得分: 2

你不需要在C++中创建tlh文件。一旦你在#import命令中指定了tlb文件,编译器会自动生成它。

你需要执行以下步骤:

  1. 在你的C#项目中,打开AssemblyInfo.cs文件(位于Properties目录中)。

[ComVisible(true)]设置为true(默认为false)。

  1. 一旦构建项目,tlb文件将在输出目录中创建。

  2. 在C++代码中,使用#import "SomeFile.tlb"

英文:

You dont need to create the tlh file in C++. It's auto generated by the compiler once you specify the tlb file in the #import command.

You need to do following:

  1. In your C# project, open the AssemblyInfo.cs (located in Properties directory).

Set [ComVisible(true)] (default is false).

  1. Once you build the project, the tlb file will be created in the output directory.

  2. In C++ code, use #import "SomeFile.tlb".

huangapple
  • 本文由 发表于 2020年1月6日 18:22:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/59610340.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定