类型“System.ComponentModel.Component”在未被引用的程序集中定义。
别的项目中都可用,可一换我现在的项目就出错了。publicStringgetMAC(){//System.ComponentModel.Component;strings...
别的项目中都可用,可一换我现在的项目就出错了。
public String getMAC()
{
//System.ComponentModel.Component;
string s = "", mac = "";
string hostInfo = Dns.GetHostName();
System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;
for (int i = 0; i < addressList.Length; i++)
{
s += addressList[i].ToString();
}
ManagementClass mc;
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (mo["IPEnabled"].ToString() == "True")
{
mac = mo["MacAddress"].ToString();
}
}
return "$009@" + mac + "#";
}
类型“System.ComponentModel.Component”在未被引用的程序集中定义。必须添加对程序集“System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”的引用。 展开
public String getMAC()
{
//System.ComponentModel.Component;
string s = "", mac = "";
string hostInfo = Dns.GetHostName();
System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;
for (int i = 0; i < addressList.Length; i++)
{
s += addressList[i].ToString();
}
ManagementClass mc;
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (mo["IPEnabled"].ToString() == "True")
{
mac = mo["MacAddress"].ToString();
}
}
return "$009@" + mac + "#";
}
类型“System.ComponentModel.Component”在未被引用的程序集中定义。必须添加对程序集“System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”的引用。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询