Albacore: Breaking Changes In Location Of Executables


I was working on cleaning up Albacore this weekend, and I noted that both the NCoverConsole and MSBuild tasks in Albacore both require the location of the .exe, to execute. The MSBuild task defaults itself to the .NET 3.5 SP1 folder, if none is specified, but the NCoverConsole task requires the path to be specified. With both of these requiring a path to the .exe file, it made sense to consolidate the functionality of storing the location and executing the command in a module. This would help to ensure consistency across all the tasks that need to execute something on the command line.

 

Breaking Change: ‘path_to_exe’ is now ‘path_to_command’

In the process of putting together the basic module for this, I decided that ‘path_to_exe’ is not the right setting name. Rather, ‘path_to_command’ is more appropriate, in case someone wants to use a .bat, .cmd or other executable file extension.

MSBuildTask:

   1: desc "Run a sample build using the MSBuildTask"

   2: Rake::MSBuildTask.new(:msbuild) do |msb|

   3:   msb.path_to_command = "C:/Windows/Microsoft.Net/Framework/v3.5/MSBuild.exe"  

   4:  

   5:   msb.properties :configuration => :Debug

   6:   msb.targets [:Clean, :Build]

   7:   msb.solution = "lib/spec/support/TestSolution/TestSolution.sln"

   8: end

</div> </div>

NCoverConsoleTask:

   1: desc "Run a sample NCover Console code coverage"

   2: Rake::NCoverConsoleTask.new(:ncoverconsole) do |ncc|

   3:   ncc.path_to_command = "lib/spec/support/Tools/NCover-v3.2/NCover.Console.exe"

   4:     

   5:   ncc.log_level = :verbose

   6:   ncc.output = {:xml => "lib/spec/support/CodeCoverage/test-coverage.xml"}

   7:   ncc.working_directory = "lib/spec/support/CodeCoverage"

   8:     

   9:   nunit = NUnitTestRunner.new("lib/spec/support/Tools/NUnit-v2.5/nunit-console.exe")

  10:   nunit.log_level = :verbose

  11:   nunit.assemblies << "assemblies/TestSolution.Tests.dll"

  12:   nunit.options << '/noshadow'

  13:     

  14:   ncc.testrunner = nunit

  15: end

</div> </div>

 

Breaking Change: no second parameter for MSBuildTask.New

Also – to keep things a little more consistent, I decided to remove the second parameter from the MSBuildTask initializer. You can no longer specify the path to the msbuild.exe in the initializer. Rather, you should specify it in the settings of the task, as shown in the above example.

 

Feedback Welcome

I always welcome feedback, especially with this project being in such an early stage and with so few tasks available, so far. If you liked the optional MSBuildTask initializer parameter, if you think path_to_exe is a better name, or if you have any other questions, comments, or suggestions, please drop me a line. The easiest way to do that is over on the Albacore Issues list, or through ‘Contact’ link in the sidebar of this page.

Albacore AssemblyInfo Task vs. Nant Assembly Info Generator