edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/context.rb;C532903
File: context.rb
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/context.rb;C532903  (server)    9/2/2008 4:57 PM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/context.rb;config-1
@@ -120,7 +120,7 @@
       @framework_path.each do |candidate|
         raise "cannot resolve path #{path}" if candidate.nil?
         candidate_path = candidate + path
-        break candidate_path if candidate_path.exist?
+        break candidate_path if candidate_path.file?
       end
     end
   end
@@ -702,6 +702,7 @@
   map :build, :merlin => 'merlin/main/bin', :svn => 'build'
   map :stdlibs, :merlin => 'merlin/external/languages/ruby/redist-libs', :svn => 'lib'
   map :ironlibs, :merlin => 'merlin/main/languages/ruby/libs', :svn => 'lib/IronRuby'
+  map :lang_root, :merlin => 'merlin/main', :svn => '.'
 end
 
 # Spec runner helpers
===================================================================
delete: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/external_ir.exe.config;C521915
File: external_ir.exe.config
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/external_ir.exe.config;C521915  (server)    9/2/2008 4:57 PM
+++ [no target file]
@@ -1,5 +1,0 @@
-<configuration>
-  <appSettings>
-    <add key="LibPaths" value="..\..\lib\IronRuby;..\..\lib\ruby\site_ruby\1.8;..\..\lib\ruby\site_ruby;..\..\lib\ruby\1.8" />
-  </appSettings>
-</configuration>
===================================================================
delete: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/ir.exe.config;C521915
File: ir.exe.config
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/ir.exe.config;C521915  (server)    9/2/2008 4:57 PM
+++ [no target file]
@@ -1,5 +1,0 @@
-<configuration>
-  <appSettings>
-    <add key="LibPaths" value="..\lib\IronRuby;..\lib\ruby\site_ruby\1.8;..\lib\ruby\site_ruby;..\lib\ruby\1.8" />
-  </appSettings>
-</configuration>
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Rakefile;C534984
File: Rakefile
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Rakefile;C534984  (server)    9/2/2008 4:57 PM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Rakefile;config-1
@@ -24,6 +24,8 @@
 
 require 'pathname2'
 require 'tmpdir'
+require 'rexml/document'
+include REXML
 
 verbose(false) # default to non-verbose output
 
@@ -33,6 +35,7 @@
 CS_COMPILER           = ENV['mono'].nil? ? 'csc' : 'gmcs'
 EXCLUDED_EXTENSIONS   = ['.old', '.suo', '.vspscc', '.vssscc', '.user', '.log', '.pdb', '.cache', '.swp']
 EXCLUDED_DIRECTORIES  = ['.svn', 'obj', '.', '..']
+PACKAGE_DIR           = 'c:\ironruby'  # directory that binary package is created in
 
 require 'context'
 
@@ -90,6 +93,12 @@
       copy IronRuby.source + 'IronRuby.sln', temp_dir + 'Merlin/Main/languages/ruby/Ruby.sln'
     end
 
+    # Special-cased one-way copy of app.config to external layout
+
+    if IronRuby.is_merlin?
+      copy get_source_dir(:lang_root) + 'app.config', temp_dir + 'app.config'
+    end
+
     # Diff and push temp directory files to the target
 
     push_to_target temp_dir
@@ -238,7 +247,7 @@
   IronRuby.source_context do
     compile :dlr_core, :references => ['!System.dll', '!System.Configuration.dll'], :switches => ['target:library', 'define:MICROSOFT_SCRIPTING_CORE'], :output => 'Microsoft.Scripting.Core.dll'
     resources = { Pathname.new('math') + 'MathResources.resx' => Pathname.new('Microsoft.Scripting.Math.MathResources.resources') }
-    compile :dlr_libs, :references => ['Microsoft.Scripting.Core.dll', '!System.dll', '!System.Configuration.dll'], :switches => ['target:library'], :resources => resources, :output => 'Microsoft.Scripting.dll'
+    compile :dlr_libs, :references => ['Microsoft.Scripting.Core.dll', '!System.Xml.dll', '!System.dll', '!System.Configuration.dll'], :switches => ['target:library'], :resources => resources, :output => 'Microsoft.Scripting.dll'
   end
 end
 
@@ -263,12 +272,50 @@
   end
 end
 
-desc "compile just the IronRuby console"
+def transform_config(target_path, signed, paths)
+  file = File.new get_source_dir(:lang_root) + 'app.config'
+  doc = Document.new file
+
+  # disable signing
+  unless signed 
+    configSections = XPath.each(doc, '/configuration/configSections/section') do |node|
+      node.attributes['type'].gsub!(/31bf3856ad364e35/, 'null')
+    end
+
+    # disable signing in IronRuby and replace the paths
+    languages = XPath.each(doc, '/configuration/microsoft.scripting/languages/language') do |node|
+      if node.attributes['names'] == 'IronRuby;Ruby;rb'
+        node.attributes['type'].gsub!(/31bf3856ad364e35/, 'null')
+      end
+    end
+  end
+
+  # replace LibraryPaths
+  options = XPath.each(doc, '/configuration/microsoft.scripting/options/set') do |node|
+    if node.attributes['language'] == 'Ruby' && node.attributes['option'] == 'LibraryPaths'
+      node.attributes['value'] = paths
+    end
+  end
+
+  File.open(target_path, 'w+') do |f|
+    f.write doc.to_s
+  end
+end
+
+def transform_config_file(configuration, target_build_path)
+  # signing is on for IronRuby in Merlin, off for SVN and Binary
+  layout = {'Merlin' => { :signing => false, :LibraryPaths => '..\..\Languages\Ruby\libs;..\..\..\External\Languages\Ruby\Ruby-1.8.6\lib\ruby\site_ruby\1.8;..\..\..\External\Languages\Ruby\Ruby-1.8.6\lib\ruby\site_ruby;..\..\..\External\Languages\Ruby\Ruby-1.8.6\lib\ruby\1.8' }, 
+            'Svn'    => { :signing => false, :LibraryPaths => '..\..\lib\IronRuby;..\..\lib\ruby\site_ruby\1.8;..\..\lib\ruby\site_ruby;..\..\lib\ruby\1.8' },
+            'Binary' => { :signing => true,  :LibraryPaths => '..\lib\IronRuby;..\lib\ruby\site_ruby\1.8;..\lib\ruby\site_ruby;..\lib\ruby\1.8' } }
+  
+  transform_config target_build_path, layout[configuration][:signing], layout[configuration][:LibraryPaths]
+end
+
+desc "compile IronRuby console"
 task :compile_console => [:compile_libraries] do
   IronRuby.source_context do
     compile :console, :references => ['Microsoft.Scripting.Core.dll', 'Microsoft.Scripting.dll', 'IronRuby.dll'], :output => IRONRUBY_COMPILER
-    config = IronRuby.is_merlin? ? 'merlin' : 'external'
-    system %Q{copy "#{get_source_dir(:root)}\\#{config}_ir.exe.config" "#{build_path}\\ir.exe.config"}
+    transform_config_file IronRuby.is_merlin? ? 'Merlin' : 'Svn', "#{build_path}\\ir.exe.config"
   end
 end
 
@@ -686,16 +733,32 @@
 
 desc "Generate an IronRuby binary redist package from the layout"
 task :package do
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\ir.exe.config" "c:\\ironruby\\bin\\ir.exe.config"}
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\ir.exe" c:\\ironruby\\bin\\}
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\ir.exe.config" c:\\ironruby\\bin\\}
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\IronRuby*.dll" c:\\ironruby\\bin\\}
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\Microsoft.Scripting.Core.dll" c:\\ironruby\\bin\\}
-  system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\Microsoft.Scripting.dll" c:\\ironruby\\bin\\}
-  system %Q{del "#{ENV['TEMP']}\\ironruby.7z"}
-  system %Q{"#{ENV['PROGRAM_FILES_32']}/7-Zip/7z.exe" a -bd -t7z -mx9 "#{ENV['TEMP']}\\ironruby.7z" "c:\\ironruby\\"}
-  system %Q{"#{ENV['PROGRAM_FILES_32']}/7-Zip/7z.exe" a -bd -tzip -mx9 "c:\\ironruby.zip" "c:\\ironruby\\"}
-  system %Q{copy /b /Y "#{ENV['PROGRAM_FILES_32']}\\7-Zip\\7zSD.sfx" + "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\sfx_config.txt" + "#{ENV['TEMP']}\\ironruby.7z" "c:\\ironruby.exe"}
+  IronRuby.source_context do 
+    # Directory layouts
+    system %Q{rmdir /S /Q #{PACKAGE_DIR}}
+    mkdir_p PACKAGE_DIR
+    mkdir_p "#{PACKAGE_DIR}\\bin"
+
+    # Copy binaries
+    system %Q{copy "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\IronRuby.BinaryLayout.config" "#{PACKAGE_DIR}\\bin\\ir.exe.config"}
+    system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\ir.exe" #{PACKAGE_DIR}\\bin\\}
+    system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\IronRuby*.dll" #{PACKAGE_DIR}\\bin\\}
+    system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\Microsoft.Scripting.Core.dll" #{PACKAGE_DIR}\\bin\\}
+    system %Q{copy "#{ENV['MERLIN_ROOT']}\\bin\\release\\Microsoft.Scripting.dll" #{PACKAGE_DIR}\\bin\\}
+
+    # Generate ir.exe.config
+    transform_config_file 'Binary', "#{PACKAGE_DIR}\\bin\\ir.exe.config"
+
+    # Copy standard library
+    system %Q{xcopy /E /I "#{ENV['MERLIN_ROOT']}\\..\\External\\Languages\\Ruby\\redist-libs\\ruby" #{PACKAGE_DIR}\\lib\\ruby}
+    system %Q{xcopy /E /I "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\Libs" #{PACKAGE_DIR}\\lib\\IronRuby}
+
+    # Generate compressed package
+    system %Q{del "#{ENV['TEMP']}\\ironruby.7z"}
+    system %Q{"#{ENV['PROGRAM_FILES_32']}/7-Zip/7z.exe" a -bd -t7z -mx9 "#{ENV['TEMP']}\\ironruby.7z" "#{PACKAGE_DIR}\\"}
+    system %Q{"#{ENV['PROGRAM_FILES_32']}/7-Zip/7z.exe" a -bd -tzip -mx9 "c:\\ironruby.zip" "#{PACKAGE_DIR}\\"}
+    system %Q{copy /b /Y "#{ENV['PROGRAM_FILES_32']}\\7-Zip\\7zSD.sfx" + "#{ENV['MERLIN_ROOT']}\\Languages\\Ruby\\sfx_config.txt" + "#{ENV['TEMP']}\\ironruby.7z" "c:\\ironruby.exe"}
+  end
 end
 
 task :default => [:happy] do
===================================================================
