nant构建脚本任务

时间:2011-11-16 04:05:12

标签: nant

编译失败:             c:\ Users \ miralp \ AppData \ Local \ Temp_qjans4v.0.cs(36,6):错误CS0012:类型'System.Xml.XmlDocument'在未引用的程序集中定义。您必须添加对程序集'System.Xml,Version = 1.0.3300.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的引用。 我收到此错误,构建文件看起来像

<?xml version="1.0" encoding="utf-8"?>
<project name="Ttl.Deploy.Refunds.Functions.build" basedir="." xmlns="http://nant.sf.net/release/0.85/nant.xsd">

    <script language="C#" prefix="ttl" >
        <code>
            <references>
                    <include name="System.Xml.dll" />
                    <include name="System.dll" />       
                    <include name="System.IO.dll" />        
                    <include name="NAnt.Core.dll" />

                </references>
                <imports>
                    <import namespace="System.Xml" />
                    <import namespace="System" />
                    <import namespace="System.IO" />
                    <import namespace="NAnt.Core" />

                </imports>
            <![CDATA[
                [Function("expand_nant_properties_into_template")]
                public string Expand_nant_properties_into_template(string templateFilepath, string propertiesFilepath, string applicationVersion)
                {
                    const int INDENT_LEVEL = 0;
                    const string APPLICATION_VERSION = "applicationVersion";

                    //Get the contents of the template to be expanded
                    string template = new FileInfo(templateFilepath)
                                                .OpenText()
                                                .ReadToEnd();

                    //Create a new NAnt project with only the properties in the properties file
                    Project project = new Project(propertiesFilepath, Level.None, INDENT_LEVEL);
                    project.Properties.Add(APPLICATION_VERSION, applicationVersion);

                    //Load the properties into memory
                    project.Run();

                    return project.Properties.ExpandProperties(template, Location.UnknownLocation);
                }
            ]]>
        </code>
    </script>


</project>

1 个答案:

答案 0 :(得分:0)

尝试设置nant.settings.currentframework属性,如下所示:

<property name="nant.settings.currentframework" value="net-3.5" />