【问题标题】:NAnt + Project with GUID must be included必须包含带有 GUID 的 NAnt + 项目
【发布时间】:2012-09-13 12:38:13
【问题描述】:

我今天刚开始使用 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>

【问题讨论】:

  • 等等,你为什么需要 NAnt? MSBuild 4.0 完全具备 NAnt 的所有功能(老实说,在语法上非常相似)。
  • 老实说,我开始关注 NAnt 是因为它可以很好地与 NUnit 集成。虽然我目前没有使用我计划使用的那些功能。我们已经在使用 NUnit。
  • github.com/loresoft/msbuildtasksMSBuildCommunity 中有一个 NUnit 任务。而且你可以只调用控制台运行程序,这就是我每次使用 NAnt 都必须做的事情(永远无法让它的 NUnit 任务工作)。

标签: nant


【解决方案1】:

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

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 task:

<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 task 并直接调用 msbuild。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-06
    • 1970-01-01
    • 1970-01-01
    • 2022-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多