关与.net2005引用DLL的问题
Readxml.dll的代码namespace xml
{
public class Readxml
{ public XmlDocument GetXmlDocument(string strXml, string strLog)
{
XmlDocument xmldoc = null;
xmldoc = new XmlDocument();
if (strLog == "0")
{
xmldoc.Load(strXml);
}
else if (strLog == "1")
{
xmldoc.LoadXml(strXml);
} return xmldoc;
}
}
}
////////////////////////
String = “ <?xml version="1.0" encoding="GB2312" ?>
- <REQUEST>
- <ROUTE>
<VERSION>2.0</VERSION>
<SRC_ID>15000003100</SRC_ID>
<ROUTE_ID>15000000000</ROUTE_ID>
<OBJ_ID>201150000031000</OBJ_ID>
<OBJ_RANGE>01</OBJ_RANGE>
<RET_FLAG>Y</RET_FLAG>
</ROUTE>
</REQUEST>
” Using xml
程序代码
xml.Readxml x = new Readxml();
x.GetXmlDocument(str, "1");
str是没问题的,为什么编译出错?报错为:Error 1 The type 'System.Xml.XmlDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. F:\li\DLLTEST\DLL\dllTest\Form1.cs 22 13 dllTest
Readxml.dll的代码namespace xml
{
public class Readxml
{ public XmlDocument GetXmlDocument(string strXml, string strLog)
{
XmlDocument xmldoc = null;
xmldoc = new XmlDocument();
if (strLog == "0")
{
xmldoc.Load(strXml);
}
else if (strLog == "1")
{
xmldoc.LoadXml(strXml);
} return xmldoc;
}
}
}
////////////////////////
String = “ <?xml version="1.0" encoding="GB2312" ?>
- <REQUEST>
- <ROUTE>
<VERSION>2.0</VERSION>
<SRC_ID>15000003100</SRC_ID>
<ROUTE_ID>15000000000</ROUTE_ID>
<OBJ_ID>201150000031000</OBJ_ID>
<OBJ_RANGE>01</OBJ_RANGE>
<RET_FLAG>Y</RET_FLAG>
</ROUTE>
</REQUEST>
” Using xml
程序代码
xml.Readxml x = new Readxml();
x.GetXmlDocument(str, "1");
str是没问题的,为什么编译出错?报错为:Error 1 The type 'System.Xml.XmlDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. F:\li\DLLTEST\DLL\dllTest\Form1.cs 22 13 dllTest
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货