<project name="aa" default="createqueue" xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<target name="createqueue">
<echo message="started" />
<script language="C#" >
<references>
<lib>
<include name="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll" />
</lib>
</references>
<imports>
<import namespace="System" />
<import namespace="System.Messaging" />
</imports>
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
string queueName = @".\Public$\TicketMatchingService";
if (!MessageQueue.Exists(queueName))
{
MessageQueue.Create(queueName, true);
}
}
]]>
</code>
</script>
<echo message="ended" />
</target>
</project>
我收到以下错误消息
C:\queuetask.build(4,3):
Compilation failed:
c:\Documents and Settings\refundspair1\Local Settings\Temp\pnf11egc.0.cs(17,14) : error CS0234: The type or namespace name 'Messaging' does not exist in the namespace 'System' (are you missing an assembly reference?)
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using NAnt.Core;
using NAnt.Core.Attributes;
using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Messaging;
using System.Text;
using System.Text.RegularExpressions;
[FunctionSet("script", "script")]
public class nant0aac150cbd424d3c93af8adc13adf050 : NAnt.Core.FunctionSetBase {
public static void ScriptMain(Project project)
{
string queueName = @".\Public$\TicketMatchingService";
if (!MessageQueue.Exists(queueName))
{
MessageQueue.Create(queueName, true);
}
}
public nant0aac150cbd424d3c93af8adc13adf050(NAnt.Core.Project project, NAnt.Core.PropertyDictionary propDict) :
base(project, propDict) {
}
}
Total time: 0.3 seconds.