Note that there are some explanatory texts on larger screens.

plurals
  1. POFxCop 10.0 standalone failing to analyse assemblies that use AutoMapper
    primarykey
    data
    text
    <p>I am having difficulty persuading FxCop 10.0 to analyse assemblies that reference AutoMapper.</p> <p>I have created a simple class library, referenced AutoMapper via NuGet, and added the following code:</p> <pre><code>using System; namespace ClassLibrary4 { public class Class1 { public void Foo() { AutoMapper.Mapper.CreateMap&lt;Obj1, Obj2&gt;() .ForMember(x =&gt; x.Name, opt =&gt; opt.Ignore()); } } public class Obj1 { public string Name { get; set; } } public class Obj2 { public string Name { get; set; } } } </code></pre> <p>I then tried to use FxCop 10.0 to analyse the assembly via the command line, and receive the message:</p> <blockquote> <p>Could not load C:\Users\inelson\Documents\Visual Studio 2013\Projects\ClassLibrary4\ClassLibrary4\bin\Debug\ClassLibrary4.dll.</p> <p>NOTE: One or more referenced assemblies could not be found. Use the '/directory' or '/reference' switch to specify additional assembly reference search paths.</p> </blockquote> <p><strong>Unresolved reference is to System.Core Version 2.0.5.0</strong>.</p> <p>In an effort to isolate the issue, I removed the .ForMember method call, leaving Foo() as simply:</p> <pre><code>public void Foo() { AutoMapper.Mapper.CreateMap&lt;Obj1, Obj2&gt;(); } </code></pre> <p>and FxCop 10.0 now happily analyses the assembly!</p> <p>What is it with the .ForMember method that is causing the FxCop analysis to fail?</p> <p>Note that I am experiencing the same behaviour with .NET Framework versions 4.0, 4.5 or 4.5.1, and AutoMapper 3.0.0 and 3.1.0.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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