title: How to set Selenium webdriver.gecko.driver setting in C#
body: <p>Straight out of the box I can't get selenium grid to work.  I have selenium server 3.4.0 and the following code produces the error shown</p>
  
  <p><strong>Error received</strong></p>
  
  <pre><code>An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll
  
  Additional information: The path to the driver executable must be set by the 
  webdriver.gecko.driver system property; for more information, see 
  https://github.com/mozilla/geckodriver. The latest version can be downloaded 
  from https://github.com/mozilla/geckodriver/releases
  </code></pre>
  
  <p><strong>Simple code</strong></p>
  
  <pre><code>using System;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Firefox;
  using OpenQA.Selenium.Remote;
  
  namespace ConsoleApplication1
  {
      class Program
      {
          static void Main(string[] args)
          {
              var url = new Uri("http://10.6.122.49:5555/wd/hub");
  
              var options = new FirefoxOptions();
              options.SetPreference("webdriver.gecko.driver", @"D:\geckodriver.exe");
  
              var driver = new RemoteWebDriver(url, options.ToCapabilities());
  
              driver.Navigate().GoToUrl("http://www.google.com");
          }
      }
  }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p><a href="https://i.stack.imgur.com/u7ZqO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u7ZqO.png" alt="enter image description here"></a></p>