1
votes

I have the following AutoMapper configuration:

Mapper.CreateMap<Source, Dest>()                
            .ForMember(dest => dest.InitiatorUserAccountUID, opt => opt.UseValue(0));

InitiatorUserAccountUID is of type long. The Mapper.AssertConfigurationIsValid() unit test passes locally, but fails on TeamCity with the following error:

AutoMapper.AutoMapperConfigurationException: The following property on System.Int64 cannot be mapped: InitiatorUserAccountUID

When I cast 0 to long explicitly in the configuration, the test passes in both places. What can be causing this?

TeamCity build info:

  • Runner type: Visual Studio (sln)
  • Visual Studio: Microsoft Visual Studio 2013
  • Runner Type for test step: MSTest
  • Path to MSTest.exe: MSTest 2013
1

1 Answers

2
votes

The solution was to add [DeploymentItem("AutoMapper.Net4.dll")] to the test class. Everything works fine now.