我想用 c# 代码通过 nant 脚本杀死所有 IE 实例:
<target name="clean">
<script language="C#" prefix="Cleaning">
<references>
<include name="System.Diagnostics.dll" />
</references>
<imports>
<import namespace="System.Diagnostics" />
</imports>
<code>
<![CDATA[
[Function("Delete")]
public static void KillIe()
{
foreach (var process in Process.GetProcessesByName("iexplore"))
{
process.Kill();
}
}
]]>
</code>
</script>
<echo message="Calling function: ${Cleaning::KillIe()}"/>
</target>
</project>
当我执行此脚本时,我收到以下错误:
错误 CS0234:命名空间“System.Diagnostics”中不存在类型或命名空间名称“Process”(您是否缺少程序集引用?)
这里有什么问题?