1

我今天才开始使用 NAnt,我遵循了一些示例。我很难解决一个问题:

它的说法是:“必须包含 GUID '{32845370-6F32-411F-B4C5-383F9C3EDE29}' 的项目才能使构建工作。”

现在我能够追踪该项目。这是我的目录结构:

c:\dev\stockclockbuild-> 这是解决方案和构建文件所在的位置。所以我运行命令:

nant -buildfile:c:\dev\stockclockbuild\stocks.build

我有一个c:\dev\_sharedlibs\mdrlibs名为“MDR.StockPlatform”的项目,它似乎被包含在内,但在该项目文件中,我找到了错误中提到的 GUID 的项目(依赖项)。

该项目称为“MDR.Base”,但它与 MDR.StockPlatform 位于同一文件夹中。 此外,如果我要打开此解决方案并在 Visual Studio 中构建它,它构建时不会出现错误。

这是完整的详细输出:

c:\Dev\_Misc\Tools\nAnt\bin>nant -buildfile:c:\dev\stockclockbuild\stocks.build
NAnt 0.92 (Build 0.92.4543.0; release; 6/9/2012)
Copyright (C) 2001-2012 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///c:/dev/stockclockbuild/stocks.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: rebuild


clean:


build:


build.stockclock:

 [solution] Starting solution build.
 [solution] Loading projects...
 [solution] Loading project 'c:\dev\stockclockbuild\StockClock.Common\StockClock
.Common.csproj'.
 [solution] Using MSBuild version 4.0.30319.1.
 [solution] Loading referenced project 'c:\dev\_SharedLibs\MDRLibs\MDR.StockPlat
form\MDR.StockPlatform.csproj'.

BUILD FAILED

Project with GUID '{32845370-6F32-411F-B4C5-383F9C3EDE29}' must be included for
the build to work.

Total time: 0.6 seconds.

这是构建文件的副本:

<project name="Solution Build Example" default="rebuild">
    <property name="configuration" value="release"/>

    <target name="clean" description="Delete all previously compiled binaries.">
        <delete>
            <fileset>
                <include name="**/bin/**" />
                <include name="**/obj/**" />
                <include name="**/*.suo" />
                <include name="**/*.user" />
            </fileset>
        </delete>
    </target>

    <target name="build" description="Build all targets.">
        <call target="build.stockclock"/>
    </target>

    <target name="rebuild" depends="clean, build" />

    <target name="build.stockclock">
        <solution configuration="${configuration}" solutionfile="Stockclock.sln" verbose="true">
        </solution>
    </target>

</project>
4

1 回答 1

0

我假设您使用的是现代 IDE,并且来自NAnt 文档

Note: Right now, only Microsoft Visual Studio .NET 2002 and 2003 solutions and
projects are supported. Support for .NET Compact Framework projects is also not
available at this time.

在我的 NAnt 脚本中,我使用NauckIT MSBuild 任务

<msbuild projectFile="${solution.file}" targets="Build" verbosity="Quiet">
    <property name="Configuration" value="${build.configuration}" />
    <property name="Platform" value="${build.platform}" />
    <arg value="/flp:NoSummary;Verbosity=normal;LogFile=${build.log}" />
    <arg value="/p:SignAssembly=true" if="${isReleaseBuild}" />
    <arg value="/p:AssemblyOriginatorKeyFile=${solution.keyfile}" if="${isReleaseBuild}" />
    <arg value="/p:DelaySign=false" if="${isReleaseBuild}" />
</msbuild>

不过这是个人喜好,因为您也可以使用NAnt exec 任务并直接调用 msbuild。

于 2012-11-16T03:56:39.427 回答