我今天刚开始使用NAnt,我按照了一些例子。我在一个问题上遇到了困难:
它的说法是:“必须包含带有GUID的项目'{32845370-6F32-411F-B4C5-383F9C3EDE29}' 建设工作。“
现在我能够追踪该项目。这是我的目录结构:
c:\dev\stockclockbuild
- >这是解决方案和构建文件所在的位置。
所以我运行命令:
nant -buildfile:c:\dev\stockclockbuild\stocks.build
我有一个项目,它位于c:\dev\_sharedlibs\mdrlibs
,名为“MDR.StockPlatform”,似乎包括在内,但在该项目文件中,我发现了错误中提到GUID的项目(依赖项)。 / p>
该项目名为“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>
答案 0 :(得分:0)
我假设您正在使用现代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。