help for building Azure package using ClickToBuildAzurePackage.cmd

Oct 25, 2010 at 11:30 AM


This is with 0.8. I am trying to build the Azure package using ClickToBuildAzurePackage.cmd. I have not made any changes to any code nor I have added any module to 0.8, just wanted to build Azure package. I am getting following error (If I update AzurePackage.proj and comment the <CallTarget Targets="Test"/> line which bypasses the tests, then azure package gets built).

What settings do I have to do, so that Tests can be executed before package is built? Thanks & Regards, Ajay.


Test:  C:\CLProjects\OrchardDEV\lib\nunit\nunit-console.exe /nologo C:\CLProjects\Or  chardDEV\build\Compile\Orchard.Azure.Tests.dll  ProcessModel: Default    DomainUsage: Single  Execution Runtime: net-4.0.30319.1  Could not load file or assembly 'Orchard.Azure.Tests' or one of its dependenc  ies. The system cannot find the file specified.C:\CLProjects\OrchardDEV\AzurePackage.proj(69,3): error MSB6006: "nunit-console.exe" exited with code -2.Done Building Project "C:\CLProjects\OrchardDEV\AzurePackage.proj" (Build target(s)) -- FAILED.

"C:\CLProjects\OrchardDEV\AzurePackage.proj" (Build target) (1) ->(Test target) ->  C:\CLProjects\OrchardDEV\AzurePackage.proj(69,3): error MSB6006: "nunit-console.exe" exited with code -2.
    0 Warning(s)    1 Error(s)

Mar 31, 2011 at 9:26 PM
Edited Mar 31, 2011 at 9:40 PM

This happens when you run ClickToBuildAzurePackage.cmd on a 32-bit Windows workstation.  The AzurePackage.proj tells MSBuild to target x64.  The cross-compiling is allowed, which is why the script runs so long before erroring out.

The problem comes when the build script tells nunit to run the unit tests that it previously finished compiling. NUnit-console attempts to load that x64 assembly, Orchard.Azure.Tests.dll.  It doesn't understand the 64-bit format, and thinks it found a bad image, and throws an exception.  NUnit-console catches and reports this as a file not found error.

The solution: manually edit the AzurePackage.proj thusly:

  • From:
    • Line 51:       Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=x64;DefineConstants=AZURE"
    • Line 57:       Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=x64" />
  • To:
    • Line 51:       Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=AnyCPU;DefineConstants=AZURE" 
    • Line 57:       Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=AnyCPU" />


But wait! There's more! You need to re-open the solution in Orchard\src\Orchard.Azure then do Build > Clean Solution followed by Build Solution (or just Build > Rebuild Solution).  Then re-run ClickToBuildAzurePackage.cmd, which should now work.

From there, you'll probably want to take a look at And make sure you have dev storage emulator running during ClickToBuildAzurePackage.cmd. : )