Class: Raykit::MsBuild

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/msbuild.rb

Class Method Summary collapse

Class Method Details

.fix_msbuild_pathObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/raykit/msbuild.rb', line 5

def self.fix_msbuild_path
  # if msbuild in not in the current path,
  # attempt to modify the path such that is it
  has_msbuild = false
  begin
    cmd = Raykit::Command.new("msbuild --version").run
    has_msbuild = true if (cmd.exitstatus != 0)
  rescue
    has_msbuild = false
  end
  if (!has_msbuild)
    if (Dir.exist?(msbuild_path))
      puts "  added #{msbuild_path} to PATH for msbuild"
      ENV["PATH"] = ENV["PATH"] + ";#{msbuild_path}"
    end
  end
end

.msbuild_2019_pathObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/raykit/msbuild.rb', line 40

def self.msbuild_2019_path
  ["2019/Enterprise/MSBuild/Current/Bin",
   "2019/Professional/MSBuild/Current/Bin",
   "2019/Community/MSBuild/Current/Bin"].each do |relative_path|
    ["C:/Program Files/Microsoft Visual Studio/",
     "C:/Program Files (x86)/Microsoft Visual Studio/"].each do |prog_path|
      path = "#{prog_path}#{relative_path}"
      return path if Dir.exist?(path)
    end
  end
  ""
end

.msbuild_pathObject

C:Program FilesMicrosoft Visual Studio2022CommunityMsbuildCurrentBin



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/raykit/msbuild.rb', line 24

def self.msbuild_path
  ["2022/Community/Msbuild/Current/Bin",
   "2022/Professional/Msbuild/Current/Bin",
   "2019/Enterprise/MSBuild/Current/Bin",
   "2019/Professional/MSBuild/Current/Bin",
   "2019/Community/MSBuild/Current/Bin",
   "2017/BuildTools/MSBuild/15.0/Bin"].each do |relative_path|
    ["C:/Program Files/Microsoft Visual Studio/",
     "C:/Program Files (x86)/Microsoft Visual Studio/"].each do |prog_path|
      path = "#{prog_path}#{relative_path}"
      return path if Dir.exist?(path)
    end
  end
  ""
end