using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ComInterface
{
interface CommPluginInput
{
void Do();
}
public sealed class CompanyDescAttribute : Attribute
{
public CompanyDescAttribute() { }
public CompanyDescAttribute(string desc)
{
}
private string desc;
public string Desc
{
get { return desc; }
set { desc = value; }
}
}
}
在B解决方案中需要继承这个接口 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using ComInterface; namespace plugin { [CompanyDesc(Desc = "C#公司")] class CShanp : CommPluginInput //出错提示错误1“ComInterface.CommPluginInput”不可访问,因为它受保护级别限制 { public void Do() { MessageBox.Show("C# "); } } } 引用了A方案中生存的ComInterface.dll并把复到了bin\Debug下