title: How to get access to the Microsoft Fakes tool regardless of the current Visual Studio version?
body: <p>In Visual Studio, when you right click a reference, you can "Add Fakes Assembly", which kicks off a process that generates the <b>*.Fakes.dll</b> assembly.</p>
  
  <p><a href="https://i.stack.imgur.com/bzsyJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bzsyJ.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>When I looked into it, it seems that it utilizes one of the following files:</p>
  
  <ul>
  <li>Fakes.exe</li>
  <li>Fakes.v2.exe</li>
  <li>Fakes.v2.x86.exe</li>
  <li>Fakes.x86.exe</li>
  </ul>
  
  <p>I'm not sure which one, but it has to be one of those. Those files are located in (at least on my machine, but this is the common path): C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\Fakes</p>
  
  <p>The problem here is that if I want to call the fakes generation tool through command line, I have to hard code in the path which may or may not be that path. I know in the past when I attempted to programmatically discover ildasm.exe and ilasm.exe someone showed me that it was possible: <a href="https://stackoverflow.com/questions/13610483/guaranteed-way-to-find-the-filepath-of-the-ildasm-exe-and-ilasm-exe-files-regard">Guaranteed way to find the filepath of the ildasm.exe and ilasm.exe files regardless of .NET version/environment?</a></p>
  
  <p>I'm wondering is there anything similar to get the correct path for the fakes tools without having to hard-code the path in since it is unreliable to assume everyone uses the default installation drive/path and also I shouldn't assume that everyone has Visual Studio 2015, 2017, or other future versions installed.</p>
  
  <hr>
  
  <p><b>Update:</b></p>
  
  <p>I think my original question was not clear in what I'm trying to do. If I have a solution/project, this is easy to do. However, I want to do this outside of a solution/project; I want to either use a standard command window or even a PowerShell script is acceptable. Basically, I don't want to have to create a solution/project merely to access the path to the fakes tooling.</p>