使用C#开发ActiveX控件
2010-09-30 20:59:06 来源:WEB开发网更改“项目属性-应用程序-程序集信息”设置,勾选“使程序集 COM 可见”:
更改“项目属性-生成”设置,勾选“为 COM Interop 注册”(注意,此处如果实在debug状态下修改的,那在调到release状态下还需要再设置一次):
图片看不清楚?请点击这里查看原图(大图)。
修改AssemblyInfo.cs文件,添加[assembly: AllowPartiallyTrustedCallers()]项(需要引用System.Security名称空间):
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
[assembly: AssemblyTitle("Yilin.Preresearch.CSharpActiveX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("10BAR")]
[assembly: AssemblyProduct("Yilin.Preresearch.CSharpActiveX")]
[assembly: AssemblyCopyright("Copyright © 10BAR 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AllowPartiallyTrustedCallers()]
[assembly: ComVisible(true)]
[assembly: Guid("114d1f0c-43b8-40ac-ae7c-5adccc19aef3")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
更多精彩
赞助商链接