当我在巡航控制下运行它时,我的nant脚本失败(Windows Server 2003),但在控制台上运行时运行正常。
nant脚本(相关部分):
<target name="compile" depends="init">
<echo message="Build Directory is ${build.dir}" />
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="${solution.file} /m /t:Clean /p:Configuration=${project.config} /v:q" workingdir="." />
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="${solution.file} /m /t:Rebuild /p:Configuration=${project.config} /v:q" workingdir="." />
</target>
CC-配置:
<tasks>
<nant>
<executable>C:\Program Files\nant-0.86-beta1\bin\nant.exe</executable>
<baseDirectory>C:\Builds\WorkManagement\RC1</baseDirectory>
<buildArgs>-D:outputType=Xml</buildArgs>
<nologo>false</nologo>
<buildFile>WaterWorks.build</buildFile>
<targetList>
<target>build</target>
</targetList>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
</nant>
</tasks>
这一直在起作用,但我认为最近升级的nunit(到2.5.1)让事情变得混乱。
cc nant log:
Buildfile: file:///C:/Builds/WorkManagement/RC1/WaterWorks.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: build
[loadtasks] Scanning assembly "NCoverExplorer.NAntTasks" for extensions.
[property] Read-only property "outputType" cannot be overwritten.
clean:
[delete] Deleting directory 'C:\Builds\WorkManagement\RC1\build'.
version:
init:
[tstamp] 15 July 2009 10:31:20.
[mkdir] Creating directory 'C:\Builds\WorkManagement\RC1\build\net-3.5.win32-WaterWorksConsole-release\'.
[echo] Current Directory: C:\Builds\WorkManagement\RC1
drop-database:
create-database:
compile:
[echo] Build Directory is build/net-3.5.win32-WaterWorksConsole-release/
[exec] Microsoft (R) Build Engine Version 3.5.21022.8
[exec] [Microsoft .NET Framework, Version 2.0.50727.1433]
[exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
[exec] Microsoft (R) Build Engine Version 3.5.21022.8
[exec] [Microsoft .NET Framework, Version 2.0.50727.1433]
[exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
[exec] C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "nunit.framework, Version=2.5.1.9189, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
[exec] AddressTests.cs(1,7): error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
:
:
运行nant的控制台命令:
nant /f:WaterWorks.build build
有点神秘!有人能指出我正确的方向吗?
答案 0 :(得分:3)
那么,您是否在GAC的连续构建机器上安装了NUnit版本2.5.1.9189? (确切的版本。)
我个人不喜欢在GAC中安装依赖项 - 我喜欢用相对路径明确引用它们,但是YMMV。
答案 1 :(得分:0)
将CruiseControl Windows服务帐户从本地系统更改为管理员或其他更高级别的帐户,修复了我们遇到的类似问题。出于某种原因,我还没想到本地系统帐户无法正常访问GAC。
您知道我们在Windows Server 2008 R2(x64)上使用的是Apache 2.2(32位),CruiseControl 2.8(32位Java版本,而不是CruiseControl.NET)。在NAnt,我们使用Devenv.com构建解决方案:
<exec program="Devenv.com" basedir="${compiler.basedir}">
<arg line='/rebuild "Release" "${solution.file}"' />
</exec>
我知道这是一个古老的问题,但上述内容可能会帮助其他人遇到类似的问题。