Sha256: 4f15c5c7ce66d62956201afb41c6c837e0e1b3f42afe683ef9da79a8bce66673

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

require 'rake'
module Albacore
  def self.find_msbuild_versions
    return nil unless ::Rake::Win32.windows?
    require 'win32/registry'
    retval = Hash.new
    begin
      Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\MSBuild\ToolsVersions') do |toolsVersion|
        toolsVersion.each_key do |key|
          begin
            versionKey = toolsVersion.open(key)
            version = key.to_i
            msb = File.join(versionKey['MSBuildToolsPath'],'msbuild.exe')
            retval[version] = msb
          rescue
            error "failed to open #{key}"
          end
        end
      end
    rescue
      error "failed to open HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions"
    end
    
    # MSBuild 15, assume default installation path
    vs2017_dir = Dir[File.join(ENV['ProgramFiles(x86)'].gsub('\\', '/'), 'Microsoft Visual Studio', '2017', '*')].first
    retval[15] = File.join(vs2017_dir, 'MSBuild', '15.0', 'Bin', 'msbuild.exe') unless vs2017_dir.nil?
    
    return retval
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
albacore-3.0.0.pre.alpha.5 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-3.0.0.pre.alpha.4 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-3.0.0.pre.alpha.3 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-3.0.0.pre.alpha.2 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-3.0.0.pre.alpha ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-2.8.0 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-2.7.0 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-2.6.8 ./lib/albacore/task_types/find_msbuild_versions.rb
albacore-2.6.7 ./lib/albacore/task_types/find_msbuild_versions.rb