Note that there are some explanatory texts on larger screens.

plurals
  1. POGems with .NET Applications - How do I set up the Executables so they run without error?
    text
    copied!<p>I have a gem, <a href="http://rubygems.org/gems/roundhouse" rel="nofollow noreferrer">roundhouse</a>, which is an application compiled with .NET (C#). Runs on Windows and it should run in a 32 bit process.</p> <p>To set up my gemspec, I set:</p> <pre><code> Gem::Specification.new do |s| s.platform = 'mswin32' s.name = 'roundhouse' s.version = version s.files = Dir['lib/**/*'] + Dir['bin/**/*'] s.bindir = 'bin' s.executables &lt;&lt; 'rh.exe' </code></pre> <p>When I install the gem, I should be able to type rh.exe from the command line at any path and it should run correctly.</p> <p>In practice, I'm not seeing this work correctly. This is what I'm getting back:</p> <blockquote> <p>Window has this for the header: 16 bit MS-DOS Subsystem</p> <p>C:\WINDOWS\system32\cmd.exe - rh.exe </p> <p>The NTVDM CPU has encountered an illegal instruction.</p> <p>CS:xxxx IP:xxxx OP:xx xx xx xx xx Choose 'Close' to terminate the application.</p> </blockquote> <p>Here is a picture of the issue (link to TwitPic): <a href="http://twitpic.com/25b5ev" rel="nofollow noreferrer">Error</a></p> <p>If I go to the directory where the item was installed, I can run it and it works great. It's just something in the registration of the command to run from anywhere.</p> <p>I did quite a bit of searching before asking and came up with nothing. It could be that I don't know what I should be searching for. So let me ask the question, is there a way to register an executable with gems for windows executable applications (built with .NET) and have them register properly with the command line? If so, how is that done? </p> <p><strong>UPDATE:</strong> I found that gems creates a shim in the C:\Ruby\bin directory that points back to the other file. So there is a rh.exe file that is really just a text file. This is its contents:</p> <pre><code>#!C:/Ruby/bin/ruby.exe # # This file was generated by RubyGems. # # The application 'roundhouse' is installed as part of a gem, and # this file is here to facilitate running it. # require 'rubygems' version = "&gt;= 0" if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then version = $1 ARGV.shift end gem 'roundhouse', version load Gem.bin_path('roundhouse', 'rh.exe', version) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload