Mike Cole
Mike Cole

Reputation: 14703

AutoMapper test fails on implicit widening conversion in TeamCity build but not locally

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:

Upvotes: 1

Views: 275

Answers (1)

Mike Cole
Mike Cole

Reputation: 14703

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

Upvotes: 2

Related Questions