<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>ajayarora</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ajayarora/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ajayarora/feed.xml</link>
    <description>Few Cents from my side</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:47:36 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Configuring Fakes</title>
      <link>https://docs.microsoft.com/archive/blogs/ajayarora/configuring-fakes</link>
      <pubDate>Fri, 28 Mar 2014 01:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Ajay Arora]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ajayarora/2014/03/28/configuring-fakes/</guid>
      <description><![CDATA[What:
Fakes exposes some configuration options through .fakes file which is part of your solution....]]></description>
      <content:encoded><![CDATA[<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN"><span style="font-weight: bold; text-decoration: underline;">What:</span></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">Fakes exposes some configuration options through .fakes file which is part of your solution. However, beyond this file there are some other options as well that are understood by the fakes engine. These options are not documented anywhere, so this blog describes some of those extra options which can be used to configure/override the default behavior of Fakes beyond what is provided by the .fakes file.</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN"><span style="font-weight: bold; text-decoration: underline;">How:</span></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">To use the below options, locate your fakes targets file from a location like : "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Fakes\Microsoft.QualityTools.Testing.Fakes.targets". Note that while some of the properties like <span style="font-style: italic;">TargetFrameworkversion </span>are directly exposed, some others like <span style="font-style: italic;">msbuildpath </span>are passed to the FakesEngine via <span style="font-style: italic;">FakesCommandLineArguments </span>like this :</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN"><span style="font-style: italic;">&lt;FakesCommandLineArguments&gt;$(FakesCommandLineArguments) /msbuildpath:"$(FakesMSBuildPath)"&lt;/FakesCommandLineArguments&gt;</span></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN"><strong><span style="text-decoration: underline;">Glossary:</span></strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">&nbsp;</p>
<table style="width: 651px;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="66">
<p>Configuration Option</p>
</td>
<td valign="top" width="78">
<p>PropertyName to Use</p>
</td>
<td valign="top" width="97">
<p>Description</p>
</td>
<td valign="top" width="127">
<p>Possible Values</p>
</td>
<td valign="top" width="225">
<p>Default Value</p>
</td>
<td valign="top" width="59">
<p>Available In Fakes file</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>&nbsp;</p>
</td>
<td valign="top" width="78">
<p>&nbsp;</p>
</td>
<td valign="top" width="97">
<p>&nbsp;</p>
</td>
<td valign="top" width="127">
<p>&nbsp;</p>
</td>
<td valign="top" width="225">
<p>&nbsp;</p>
</td>
<td valign="top" width="59">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>TargetFrameworkVersion<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>TargetFrameworkVersion<br />&nbsp;</p>
</td>
<td valign="top" width="97">
<p>Target DotNet framework version with which fakes assemblies should get compiled with.</p>
</td>
<td valign="top" width="127">
<p>A valid DotNet version</p>
</td>
<td valign="top" width="225">
<p>v4.5</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>TargetRuntimeVersion<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>TargetRuntimeVersion<br />&nbsp;</p>
</td>
<td valign="top" width="97">
<p>CLR Runtime version to be used (corresponding fakes engine executable is invoked)</p>
</td>
<td valign="top" width="127">
<p>v4.0.30319, v2.0.50727</p>
</td>
<td valign="top" width="225">
<p>v4.0.30319</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ToolsVersion</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/tv"</p>
</td>
<td valign="top" width="97">
<p>Build Toolset version to be used for creating fakes assemblies.</p>
</td>
<td valign="top" width="127">
<p>A valid toolset version</p>
</td>
<td valign="top" width="225">
<p>v4.0</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>Debug</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/d"</p>
</td>
<td valign="top" width="97">
<p>Generate the fakes assembly with 'debug' configuration.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False. ie. Build Configuration is set to Release.</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>Properties</p>
</td>
<td valign="top" width="78">
<p>FakesCompilationProperties</p>
</td>
<td valign="top" width="97">
<p>Semicolon separated list of project properties to be set in the fakes project.</p>
</td>
<td valign="top" width="127">
<p>Format : &lt;property name1&gt;=&lt;property value1&gt;;&lt;property name2&gt;=&lt;property value2&gt;;</p>
</td>
<td valign="top" width="225">
<p>None</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>KeyFile</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/key:&lt;filepath&gt;"</p>
</td>
<td valign="top" width="97">
<p>Path to the KeyFile for signing the fakes assembly.</p>
</td>
<td valign="top" width="127">
<p>&lt;filepath&gt;</p>
</td>
<td valign="top" width="225">
<p>None</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ProjectTemplate<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/pt:&lt;projfilepath&gt;"</p>
</td>
<td valign="top" width="97">
<p>Path to a .proj file which will be used as a template for creating fakes&nbsp; assembly's.proj file. This option can be used to further customize fakes code generation if the rest of the options don&rsquo;t suffice. For ex. Add a prebuild/postbuild event for the fakes assembly. Attaching a basic sample&nbsp; template to start with.</p>
<p>&lt;&lt;ProjectTemplate.csproj&gt;&gt;</p>
</td>
<td valign="top" width="127">
<p>&lt;proj file path&gt;</p>
</td>
<td valign="top" width="225">
<p>None</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>MsbuildPath</p>
</td>
<td valign="top" width="78">
<p>FakesMsbuildPath</p>
</td>
<td valign="top" width="97">
<p>Path to the msbuild executable to be used for compiling fakes assemblies</p>
</td>
<td valign="top" width="127">
<p>&lt;msbuild executable file path&gt;</p>
</td>
<td valign="top" width="225">
<p>As specified by $MSBuildToolsPath</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>FrameworkPath<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesBinPath</p>
</td>
<td valign="top" width="97">
<p>Directory Path where Microsoft.QualityTools.Testing.Fakes.dll is present</p>
</td>
<td valign="top" width="127">
<p>&lt;directory path&gt;</p>
</td>
<td valign="top" width="225">
<p>"C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio\v12.0\Fakes"</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>OutputPath</p>
</td>
<td valign="top" width="78">
<p>FakesOutputPath</p>
</td>
<td valign="top" width="97">
<p>Path to be used for dumping the generated fakes assemblies after copying them from intermediate path</p>
</td>
<td valign="top" width="127">
<p>&lt;directory path&gt;</p>
</td>
<td valign="top" width="225">
<p>&lt;currentdirectory&gt;\ FakesAssemblies</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>IntermediatePath<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesIntermediatePath</p>
</td>
<td valign="top" width="97">
<p>Path to be used for dumping the intermediate code generated during creating fakes assemblies</p>
</td>
<td valign="top" width="127">
<p>&lt;directory path&gt;</p>
</td>
<td valign="top" width="225">
<p>&lt;currentdirectory&gt;\obj</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>CleanIntermediatePath<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/clean"</p>
</td>
<td valign="top" width="97">
<p>Delete the intermediate code that gets generated during fakes creation.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ForceIntermediatePath<br />&nbsp; (depcrecated)</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/fip"</p>
</td>
<td valign="top" width="97">
<p>Normally for each assembly, a folder is created under the intermediate path using the assembly name. If this option is set, the folder creation for each assembly does not happen, and instead the same folder is shared for all assemblies.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ForceReadOnly</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/f"</p>
</td>
<td valign="top" width="97">
<p>If during fakes code generation or fakes compilation a file already exists as readonly, it won't get overwritten. Setting this option to true will ensure all readonly files are replaced.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>TargetX86</p>
</td>
<td valign="top" width="78">
<p>ForceX86</p>
</td>
<td valign="top" width="97">
<p>Force fakes engine to run as 32-bit process. Ideally the bitness is automatically determined from the assembly to be faked.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>Bitness as specified by the assembly to be faked</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>Elevated</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/admin"</p>
</td>
<td valign="top" width="97">
<p>Launch Fakes engine as elevated process. Ideally, if the invoking process is elevated, fakes process will automatically be launched elevated.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>Invoking process' elevation state</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>FakesFilesOnly<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/mfo"</p>
</td>
<td valign="top" width="97">
<p>Let's fakes accept only .fakes file, instead of accepting a .dll directly.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ProcessCount</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; "/pc:&lt;integer&gt;"</p>
</td>
<td valign="top" width="97">
<p>Number of concurrent fakes processes to spawn for generating Fakes. Ideally, if multiple assemblies are to be faked, fakes will automatically figure out and spawn the appropriate number of parallel processes based on machine's CPU Cores. This option can let you tune (lower) this value if required.</p>
</td>
<td valign="top" width="127">
<p>&lt;integer&gt;</p>
</td>
<td valign="top" width="225">
<p>Minimum of<br />{Number of CPU Cores, Number of fakes assemblies to be generated}</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>Leaf</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/l"</p>
</td>
<td valign="top" width="97">
<p>There are situations when the fakes engine needs to re-launch itself under a different environment to suite the Bitness/CLR/Elevation requirements. In some cases this might lead to an infinite invocation loop. This option can be used to avoid fakes re-launch itself&nbsp; to avoid ending up in such a situation.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>Verbosity</p>
</td>
<td valign="top" width="78">
<p>FakesVerbosity</p>
</td>
<td valign="top" width="97">
<p>Verbosity level of Fakes engine.</p>
</td>
<td valign="top" width="127">
<p>Critical|Error|Warning|<br />&nbsp;Message|Verbose|Noisy</p>
</td>
<td valign="top" width="225">
<p>Message</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>NamespaceFilter<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/nf:&lt;filterstring&gt;"</p>
</td>
<td valign="top" width="97">
<p>Filter out namespaces while generating stubs and shims</p>
</td>
<td valign="top" width="127">
<p>&lt;filter string&gt;</p>
</td>
<td valign="top" width="225">
<p>No filter</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>TypeFilter</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/tf:&lt;filterstring&gt;</p>
</td>
<td valign="top" width="97">
<p>Filter out types while generating stubs and shims</p>
</td>
<td valign="top" width="127">
<p>&lt;filter string&gt;</p>
</td>
<td valign="top" width="225">
<p>No filter</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>DisableStubs</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/nostubs"</p>
</td>
<td valign="top" width="97">
<p>Disable generation of stubs</p>
</td>
<td valign="top" width="127">
<p>&lt;filter string&gt;</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>DisableShims</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/noshims"</p>
</td>
<td valign="top" width="97">
<p>Disable generation of shims</p>
</td>
<td valign="top" width="127">
<p>&lt;filter string&gt;</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>AssemblyHash</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/ah:&lt;hash string&gt;"</p>
</td>
<td valign="top" width="97">
<p>Pass an assembly hash string, to determine if fakes code generation and fakes compilation should be skipped.</p>
</td>
<td valign="top" width="127">
<p>&lt;string&gt;</p>
</td>
<td valign="top" width="225">
<p>Null.</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>CompilationHash</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/ch:&lt;hash string&gt;"</p>
</td>
<td valign="top" width="97">
<p>Pass an assembly hash string, to determine if fakes compilation should be skipped.</p>
</td>
<td valign="top" width="127">
<p>&lt;string&gt;</p>
</td>
<td valign="top" width="225">
<p>Null.</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ForceGeneration</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/fg"</p>
</td>
<td valign="top" width="97">
<p>Overrides all hash-validation checks which skip fakes generation and generates fakes forcefully.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>No</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ReferenceAssemblies<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/r:&lt;syntax&gt;"</p>
</td>
<td valign="top" width="97">
<p>Semicolon separated list of all assembly paths that are required for resolving dependencies of the fakes assembly.</p>
<p>Path can contain environment variables.</p>
</td>
<td valign="top" width="127">
<p>Format : &lt;assembly's fully qualified name&gt;|&lt;assembly's file path&gt;. Ex: /r:ClassLibrary1,<br />&nbsp; Version=1.0.0.0, Culture=neutral, PublicKeyToken=null| C:\Release\ClassLibrary1.dll</p>
</td>
<td valign="top" width="225">
<p>None</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>ComReferences<br />&nbsp;</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/comr:&lt;syntax&gt;"</p>
</td>
<td valign="top" width="97">
<p>Path of COM references that are required for generating the fakes assembly.</p>
</td>
<td valign="top" width="127">
<p>-do-</p>
</td>
<td valign="top" width="225">
<p>None</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>DisableCodeContracts</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/nocc"</p>
</td>
<td valign="top" width="97">
<p>Skip Code Contracts during runtime instrumentation. This might be required when there are any issues with CodeContracts.</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>Yes</p>
</td>
</tr>
<tr>
<td valign="top" width="66">
<p>NoLogo</p>
</td>
<td valign="top" width="78">
<p>FakesCommandLineArguments<br />&nbsp; with "/n"</p>
</td>
<td valign="top" width="97">
<p>Disables emitting Fakes logo and copyright information</p>
</td>
<td valign="top" width="127">
<p>NA</p>
</td>
<td valign="top" width="225">
<p>False</p>
</td>
<td valign="top" width="59">
<p>No</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN"><span style="font-weight: bold; text-decoration: underline;">Note:</span></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;" lang="en-IN">You will see that some of the options are available via both places (.fakes file and .targets file). Avoid a situation where your configurations are setup in a conflicting way in both places.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/51/17/14/ProjectTemplate.csproj" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-51-17-14/ProjectTemplate.csproj">ProjectTemplate.csproj</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>