英文:
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文件,编译器会自动生成它。
你需要执行以下步骤:
- 在你的C#项目中,打开
AssemblyInfo.cs文件(位于Properties目录中)。
将[ComVisible(true)]设置为true(默认为false)。
-
一旦构建项目,tlb文件将在输出目录中创建。
-
在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:
- In your C# project, open the
AssemblyInfo.cs(located in Properties directory).
Set [ComVisible(true)] (default is false).
-
Once you build the project, the tlb file will be created in the output directory.
-
In C++ code, use
#import "SomeFile.tlb".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论