【发布时间】:2009-08-28 18:06:05
【问题描述】:
我有一个简单的 HelloWorld 应用程序,我正在尝试使用 NAnt 构建它。然而,即使使用最简单的构建文件,我仍然无法让它工作。下面是我的 HelloWorld.build 文件。
<?xml version="1.0"?>
<project name="Hello World" default="build">
<property name="nant.settings.currentframework" value="net-3.5"/>
<target name="build">
<echo>Hello</echo>
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="HelloWorld /t:Clean /p:Configuration=Debug /v:q" workingdir="." />
</target>
这是结果。
C:\webdev\HelloWorld>c:\nant-0.86-beta1\bin\NAnt.exe build
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/webdev/HelloWorld/HelloWorld.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: build
[property] Target framework changed to "Microsoft .NET Framework 3.5".
BUILD FAILED
INTERNAL ERROR
System.NullReferenceException: Object reference not set to an instance of an object.
at NAnt.Core.FrameworkInfo.get_Version()
at NAnt.Core.Project.UpdateTargetFrameworkProperties()
at NAnt.Core.Tasks.PropertyTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Project.InitializeProjectDocument(XmlDocument doc)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
Please send bug report to nant-developers@lists.sourceforge.net.
Total time: 0 seconds.
此外,当我尝试手动设置要使用的 .NET 框架时,我得到以下信息:
C:\webdev\HelloWorld>c:\nant-0.86-beta1\bin\NAnt.exe -t:net-3.5
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net
Microsoft .NET Framework 3.5 (net-3.5) is not installed, or not correctly configured.
Object reference not set to an instance of an object.
但是,配置文件确实有 .NET 3.5 的条目。这是 NAnt-0.86-beta 和 Visual C# 2008 Express Edition。我完全偏离轨道了吗?如果是这样,是否有人可能拥有可以重复使用的模板构建文件?
谢谢。
【问题讨论】:
-
请将构建文件添加到您的问题中