1

I recently upgraded to .Net-Core 3, I had a test which was using a AutoMapper as a dependency

[TestMethod]
public async Task Verify_Mapping_Projection_Behavior()
{
    var services = this.GetRegisteredRestEzServiceCollection();
    var serviceProvider = services.BuildServiceProvider();
    var context = (Context)serviceProvider.GetService<DbContext>();

    var config = new MapperConfiguration(cfg =>
    {
        cfg.CreateMap<User, UserDTO>()
            .ForMember(x => x.Id, o => o.ResolveUsing((entity, dto) => entity.Id + 1));
    });

    var mapper = config.CreateMapper();
    //...
}

I noticed my `ResolveUsing was not working anymore, so I decided to update my nuget packages. To my suprise I had no reference to AutoMapper in my nuget packages. It appears to be linked from the project reference which it's testing.

Am I one of the lucky 10,000 or Is this new behavior to .net-core? What other project behavioral differences are there between .net-core and traditional asp.net

johnny 5
  • 19,893
  • 50
  • 121
  • 195
  • 2
    This is the behavior of SDK style projects (old csproj format vs new). PackageReferences are transitive. It's not dotnet core specific – pinkfloydx33 Apr 30 '20 at 01:14
  • @pinkfloydx33 thanks, its the first time i've ever come across this, I guess I'm one of the lucky 10,000 – johnny 5 Apr 30 '20 at 13:07

0 Answers0