简单的HelloWorld构建脚本 [英] Simple HelloWorld build script

查看:180
本文介绍了简单的HelloWorld构建脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我试图建立使用恶性一个简单的HelloWorld应用程序。然而,即使是最简单的构建文件,我仍然无法得到它的工作。下面是我的HelloWorld.build文件。

I have a simple HelloWorld application that I'm trying to build using NAnt. However, even with the simplest of build files, I still cannot get it to work. Below is my HelloWorld.build file.

<?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>

下面是结果。

Here are the results.

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框架的使用,我得到如下:

Also, when I try to manually set the .NET framework to use, I get the following:

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的条目。这是恶性-0.86-β和Visual C#2008例preSS版。我是完全偏离了轨道?如果是这样,没有任何人或者有可复用的模板构建文件?

However, the config file does have an entry for .NET 3.5 .This is with NAnt-0.86-beta and Visual C# 2008 Express Edition. Am I completely off track? If so, does anyone perhaps have a template build file that can be reused?

感谢你。

推荐答案

嗯,我试了一个非常简单的控制台应用程序,除了调整命令行参数这一切工作得很好,对我构建文件。

Well I tried your build file on a very simple console application and aside from tweaking the command line arguments it all works just fine for me.

您是否尝试过重新安装.NET Framework 3.5,因为它肯定看起来像这就是失踪(如果你试图从从3.5架构目录的确切路径的CMD行执行的MSBuild会发生什么?)

Have you tried to reinstall the .net framework 3.5 as it definately looks like thats missing (what happens if you try and execute msbuild from the cmd line with the exact path from the 3.5 framework directory ?)

<?xml version="1.0"?>
<project name="HelloWorld" 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.sln /t:Clean /p:Configuration=Debug /v:q" workingdir="." />
    </target>
</project>

我的项目输出看起来像这样

the output for my project looks like this


NAnt 0.86 (Build 0.86.2898.0; beta1; 08/12/2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///C:/Documents and Settings/krystan/My Documents/Visual Studio
2008/Projects/HelloWorld/test.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: build


build:

     [echo] Hello
     [exec] Microsoft (R) Build Engine Version 3.5.30729.1
     [exec] [Microsoft .NET Framework, Version 2.0.50727.3082]
     [exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
     [exec]

BUILD SUCCEEDED

Total time: 0.2 seconds.

这篇关于简单的HelloWorld构建脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆