Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That CallingMethod might get optimized away, is something that I did not think of. Let me run a few more tests on this.</p> <p>First I invoke nant manually on the build server.</p> <pre><code>"C:\Program Files\nant-0.86-beta1\bin\nant.exe" test -D:nunit.exe.path="C:\\Program Files\\NUnit 2.4.8\bin\\" -D:Artifact.Output.Path="D:\\Build\\Mint\\Artifacts\\" -D:msbuild.logger="C:\\Program Files\\CruiseControl.NET\\server\\ThoughtWorks.CruiseControl.MSBuild.dll" -D:fxcop.exe.path="C:\\Program Files\\Microsoft FxCop 1.36\\" </code></pre> <p>This works fine and the test does not fail! I go to the produced binary and execute NUnit manually on it.</p> <pre><code>D:\Build\Mint\WorkingDirectory\Source\Test\Vanilla.UnitTests\bin\Debug&gt;"C:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" Vanilla.UnitTests.dll NUnit version 2.4.8 Copyright (C) 2002-2007 Charlie Poole. Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. Copyright (C) 2000-2002 Philip Craig. All Rights Reserved. Runtime Environment - OS Version: Microsoft Windows NT 5.2.3790 Service Pack 2 CLR Version: 2.0.50727.3082 ( Net 2.0.50727.3082 ) .............................................................. Tests run: 62, Failures: 0, Not run: 0, Time: 7.891 seconds </code></pre> <p>And it works as it should. But when I force a build through CC.NET the test fails like I've shown above. Then if I pick the binaries produced by the build server and run NUnit on those I'm back at success.</p> <p>So, the binaries does't change, but the test succeeds/fails depending on if NAnt is run through command line or CC.NET.</p> <p>This is the cc.net task I use to execute my NAnt build script.</p> <pre><code>&lt;nant&gt; &lt;executable&gt;C:\Program Files\nant-0.86-beta1\bin\nant.exe&lt;/executable&gt; &lt;buildArgs&gt;-D:nunit.exe.path="C:\\Program Files\\NUnit 2.4.8\bin\\" -D:Artifact.Output.Path="D:\\Build\\Mint\\Artifacts\\" -D:msbuild.logger="C:\\Program Files\\CruiseControl.NET\\server\\ThoughtWorks.CruiseControl.MSBuild.dll" -D:fxcop.exe.path="C:\\Program Files\\Microsoft FxCop 1.36\\"&lt;/buildArgs&gt; &lt;nologo&gt;true&lt;/nologo&gt; &lt;buildFile&gt;Mint.build&lt;/buildFile&gt; &lt;targetList&gt; &lt;target&gt;clean&lt;/target&gt; &lt;target&gt;build&lt;/target&gt; &lt;target&gt;test&lt;/target&gt; &lt;target&gt;staticAnalysis&lt;/target&gt; &lt;/targetList&gt; &lt;buildTimeoutSeconds&gt;1200&lt;/buildTimeoutSeconds&gt; &lt;/nant&gt; </code></pre> <p>The task to execute NUnit in my build script is a bit messier.</p> <pre><code>&lt;!-- Run all tests --&gt; &lt;target name="test" description="Run NUnit tests" depends="build"&gt; &lt;property name="Failed.Test.Count" value="0"/&gt; &lt;!-- Test Vanilla --&gt; &lt;property name="Test.Name" value="Vanilla.UnitTests" /&gt; &lt;call target="runCurrentTest" /&gt; &lt;fail if="${int::parse(Failed.Test.Count)&gt;0}" message="Failures reported in unit tests" /&gt; &lt;/target&gt; &lt;!-- Utility method to run tests --&gt; &lt;target name="runCurrentTest"&gt; &lt;exec program="${nunit.exe.path}nunit-console.exe" failonerror="false" resultproperty="Test.Result" verbose="true"&gt; &lt;arg value="${Test.Path + Test.Name + '\bin\Debug\' + Test.Name}.dll" /&gt; &lt;arg value="/xml:${Artifact.Output.Path + Test.Name}-nunit-results.xml" /&gt; &lt;arg value="/nologo" /&gt; &lt;/exec&gt; &lt;property name="Failed.Test.Count" value="${int::parse(Test.Result) + int::parse(Failed.Test.Count)}"/&gt; &lt;/target&gt; </code></pre> <p>Can I explicitly put optimization flag on the msbuild exec call, to determine that it is not a problem like that? I do point the compilation directly to the csproj file. Shouldn't msbuild pick the optimize configuration from there?</p> <p>Thank you for all your input! Mikael Lundin</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload