diff --git a/.editorconfig b/.editorconfig index 848b5c0181..2524b768e6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -97,4 +97,7 @@ indent_size = 2 indent_size = 2 [*.csproj] +indent_size = 2 + +[*.yml] indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9acdc59af4..da05b683ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,32 +15,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - build-windows: - strategy: - fail-fast: false - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4.2.0 - with: - fetch-depth: 0 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 8.0.x - 9.0.x - - name: Build and Test - run: | - dotnet build --configuration Release - - dotnet test --configuration Release --no-build --results-directory ".\artifacts" -l trx .\src\UnitTests - - dotnet test --configuration Release --no-build --results-directory ".\artifacts" -l trx .\src\AutoMapper.DI.Tests - - shell: pwsh build: - needs: build-windows strategy: fail-fast: false runs-on: ubuntu-latest @@ -58,15 +33,34 @@ jobs: - name: Build and Test run: ./Build.ps1 shell: pwsh - - name: Push to MyGet - if: github.ref == 'refs/heads/master' - env: - NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json - NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }} - run: ./Push.ps1 - shell: pwsh - - name: Artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts - path: artifacts/**/* \ No newline at end of file + build-windows: + needs: build + strategy: + fail-fast: false + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4.2.0 + with: + fetch-depth: 0 + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x + - name: Build and Test + run: ./Build.ps1 + shell: pwsh + - name: Push to MyGet + if: github.ref == 'refs/heads/master' + env: + NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json + NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }} + run: ./Push.ps1 + shell: pwsh + - name: Artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: artifacts/**/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13d67d3c6c..7e434574c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,70 +1,62 @@ name: Release - on: push: tags: - - '*.*.*' + - "*.*.*" permissions: contents: read - jobs: - build-windows: + build: strategy: fail-fast: false - runs-on: windows-latest + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 8.0.x - 9.0.x - - name: Build and Test - run: | - dotnet build --configuration Release - - dotnet test --configuration Release --no-build --results-directory ".\artifacts" -l trx .\src\UnitTests - - dotnet test --configuration Release --no-build --results-directory ".\artifacts" -l trx .\src\AutoMapper.DI.Tests - - shell: pwsh - build: - needs: build-windows + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x + - name: Build and Test + run: ./Build.ps1 + shell: pwsh + build-windows: + needs: build strategy: fail-fast: false - runs-on: ubuntu-latest + runs-on: windows-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 8.0.x - 9.0.x - - name: Build and Test - run: ./Build.ps1 - shell: pwsh - - name: Push to MyGet - env: - NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json - NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }} - run: ./Push.ps1 - shell: pwsh - - name: Push to NuGet - env: - NUGET_URL: https://api.nuget.org/v3/index.json - NUGET_API_KEY: ${{ secrets.AUTOMAPPER_NUGET_API_KEY }} - run: ./Push.ps1 - shell: pwsh - - name: Artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts - path: artifacts/**/* \ No newline at end of file + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x + - name: Build and Test + run: ./Build.ps1 + shell: pwsh + - name: Push to MyGet + env: + NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json + NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }} + run: ./Push.ps1 + shell: pwsh + - name: Push to NuGet + env: + NUGET_URL: https://api.nuget.org/v3/index.json + NUGET_API_KEY: ${{ secrets.AUTOMAPPER_NUGET_API_KEY }} + run: ./Push.ps1 + shell: pwsh + - name: Artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: artifacts/**/* diff --git a/AutoMapper.WindowsCI.slnf b/AutoMapper.WindowsCI.slnf new file mode 100644 index 0000000000..7cf49bf142 --- /dev/null +++ b/AutoMapper.WindowsCI.slnf @@ -0,0 +1,10 @@ +{ + "solution": { + "path": "AutoMapper.sln", + "projects": [ + "src\\AutoMapper\\AutoMapper.csproj", + "src\\AutoMapper.DI.Tests\\AutoMapper.DI.Tests.csproj", + "src\\UnitTests\\AutoMapper.UnitTests.csproj" + ] + } +} diff --git a/Build.ps1 b/Build.ps1 index f78e52ab9b..b37ce69612 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -26,6 +26,18 @@ $artifacts = ".\artifacts" if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse } -exec { & dotnet test -c Release --results-directory $artifacts -l trx } +if ($env:GITHUB_ACTIONS -eq 'true' -and $env:RUNNER_OS -eq 'Windows') { + Write-Host "✅ Running inside GitHub Actions on a Windows runner" + $solution = "./AutoMapper.WindowsCI.slnf" +} +else { + Write-Host "🖥️ Running locally or on a different platform" + $solution = "./AutoMapper.sln" +} -exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj -c Release -o $artifacts --no-build } +exec { & dotnet test $solution --configuration Release --results-directory $artifacts --logger trx } + +# Only pack AutoMapper project on Windows runners in GitHub Actions +if ($env:GITHUB_ACTIONS -eq 'true' -and $env:RUNNER_OS -eq 'Windows') { + exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj --configuration Release --output $artifacts --no-build } +} diff --git a/Directory.Build.props b/Directory.Build.props index 52fa6c08a1..9b4a5ab2dd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,15 @@ enable + + $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_OSX()))) + $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows()))) + + + + $(DefineConstants);FULL_OR_STANDARD + + diff --git a/src/AutoMapper/AutoMapper.csproj b/src/AutoMapper/AutoMapper.csproj index fd7eab49a6..0e183d062c 100644 --- a/src/AutoMapper/AutoMapper.csproj +++ b/src/AutoMapper/AutoMapper.csproj @@ -30,7 +30,7 @@ - $(TargetFrameworks);net462 + $(TargetFrameworks);net471 @@ -47,9 +47,9 @@ - + - + diff --git a/src/AutoMapper/Configuration/PathConfigurationExpression.cs b/src/AutoMapper/Configuration/PathConfigurationExpression.cs index 9a6d4e1ef4..efdd49a9db 100644 --- a/src/AutoMapper/Configuration/PathConfigurationExpression.cs +++ b/src/AutoMapper/Configuration/PathConfigurationExpression.cs @@ -66,7 +66,7 @@ internal static IPropertyMapConfiguration Create(LambdaExpression destination, L public LambdaExpression SourceExpression => _sourceExpression; public LambdaExpression GetDestinationExpression() => _destinationExpression; public IPropertyMapConfiguration Reverse() => Create(_sourceExpression, _destinationExpression); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public bool Ignored => false; #endif diff --git a/src/AutoMapper/Execution/TypeMapPlanBuilder.cs b/src/AutoMapper/Execution/TypeMapPlanBuilder.cs index 5fe693bf8e..06cf1de571 100644 --- a/src/AutoMapper/Execution/TypeMapPlanBuilder.cs +++ b/src/AutoMapper/Execution/TypeMapPlanBuilder.cs @@ -589,7 +589,7 @@ public IValueResolver CloseGenerics(TypeMap typeMap) => _members[0].DeclaringTyp Array.ConvertAll(_members, m => m.Name), typeMap)) : this; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public string SourceMemberName => null; #endif } @@ -607,7 +607,7 @@ public Expression GetExpression(IGlobalConfiguration configuration, MemberMap me configuration.ConvertReplaceParameters(Lambda, [source, destination, destinationMember, ContextParameter]); public MemberInfo GetSourceMember(MemberMap _) => null; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public string SourceMemberName => null; public LambdaExpression ProjectToExpression => null; public IValueResolver CloseGenerics(TypeMap typeMap) => this; @@ -634,7 +634,7 @@ public Expression GetExpression(IGlobalConfiguration configuration, MemberMap me public MemberInfo GetSourceMember(MemberMap _) => Lambda.GetMember(); public LambdaExpression ProjectToExpression => Lambda; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public string SourceMemberName => null; public IValueResolver CloseGenerics(TypeMap typeMap) => this; #endif @@ -701,7 +701,7 @@ AutoMapperConfigurationException BuildExceptionMessage() _ => memberMap.SourceMembers.Length == 1 ? memberMap.SourceMembers[0] : null }; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public LambdaExpression ProjectToExpression => null; public IValueResolver CloseGenerics(TypeMap typeMap) => this; #endif @@ -760,7 +760,7 @@ public Expression GetExpression(IGlobalConfiguration configuration, MemberMap me public MemberInfo GetSourceMember(MemberMap _) => SourceMemberLambda?.GetMember(); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public LambdaExpression ProjectToExpression => null; public IValueResolver CloseGenerics(TypeMap typeMap) => this; #endif diff --git a/src/AutoMapper/Internal/Polyfill.cs b/src/AutoMapper/Internal/Polyfill.cs index 0c8ce9c07d..48290f321f 100644 --- a/src/AutoMapper/Internal/Polyfill.cs +++ b/src/AutoMapper/Internal/Polyfill.cs @@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD namespace AutoMapper; internal static class Polyfill diff --git a/src/AutoMapper/Mappers/AssignableMapper.cs b/src/AutoMapper/Mappers/AssignableMapper.cs index 21db7f70a1..fe0f39f6b2 100644 --- a/src/AutoMapper/Mappers/AssignableMapper.cs +++ b/src/AutoMapper/Mappers/AssignableMapper.cs @@ -5,7 +5,7 @@ public sealed class AssignableMapper : IObjectMapper public bool IsMatch(TypePair context) => context.DestinationType.IsAssignableFrom(context.SourceType); public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) => sourceExpression; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/CollectionMapper.cs b/src/AutoMapper/Mappers/CollectionMapper.cs index 955c42e7c9..c7769b20fa 100644 --- a/src/AutoMapper/Mappers/CollectionMapper.cs +++ b/src/AutoMapper/Mappers/CollectionMapper.cs @@ -107,7 +107,7 @@ void GetDestinationType() return; } destinationElementType = GetEnumerableElementType(destinationType); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD destinationCollectionType = destinationType.IsGenericType(typeof(ISet<>)) ? typeof(HashSet<>) : typeof(ICollection<>); #else destinationCollectionType = destinationType.IsGenericType(typeof(IReadOnlySet<>)) ? typeof(HashSet<>) : typeof(ICollection<>); diff --git a/src/AutoMapper/Mappers/ConstructorMapper.cs b/src/AutoMapper/Mappers/ConstructorMapper.cs index cabe36aab2..3deac9f68f 100644 --- a/src/AutoMapper/Mappers/ConstructorMapper.cs +++ b/src/AutoMapper/Mappers/ConstructorMapper.cs @@ -9,7 +9,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p var constructor = GetConstructor(sourceExpression.Type, destExpression.Type); return New(constructor, ToType(sourceExpression, constructor.FirstParameterType())); } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ConversionOperatorMapper.cs b/src/AutoMapper/Mappers/ConversionOperatorMapper.cs index f59061c9b4..469343015a 100644 --- a/src/AutoMapper/Mappers/ConversionOperatorMapper.cs +++ b/src/AutoMapper/Mappers/ConversionOperatorMapper.cs @@ -20,7 +20,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p var conversionOperator = GetConversionOperator(sourceExpression.Type, destExpression.Type); return Call(conversionOperator, ToType(sourceExpression, conversionOperator.FirstParameterType())); } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } diff --git a/src/AutoMapper/Mappers/ConvertMapper.cs b/src/AutoMapper/Mappers/ConvertMapper.cs index 1812c0bdb9..767ec457fd 100644 --- a/src/AutoMapper/Mappers/ConvertMapper.cs +++ b/src/AutoMapper/Mappers/ConvertMapper.cs @@ -10,7 +10,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p var convertMethod = typeof(Convert).GetMethod("To" + destExpression.Type.Name, [sourceExpression.Type]); return Call(convertMethod, sourceExpression); } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumToEnumMapper.cs b/src/AutoMapper/Mappers/EnumToEnumMapper.cs index 8d8c793706..3a6827214e 100644 --- a/src/AutoMapper/Mappers/EnumToEnumMapper.cs +++ b/src/AutoMapper/Mappers/EnumToEnumMapper.cs @@ -16,7 +16,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p statements.Add(Condition(tryParse, result, Convert(sourceExpression, destinationType))); return Block(variables, statements); } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/FromDynamicMapper.cs b/src/AutoMapper/Mappers/FromDynamicMapper.cs index f1b1663b01..34928c66ad 100644 --- a/src/AutoMapper/Mappers/FromDynamicMapper.cs +++ b/src/AutoMapper/Mappers/FromDynamicMapper.cs @@ -35,7 +35,7 @@ private static object GetDynamically(string memberName, object target) public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) => Call(MapMethodInfo, sourceExpression, destExpression.ToObject(), Constant(destExpression.Type), ContextParameter, Constant(profileMap)); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs b/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs index 9eb8a20c21..95035d420c 100644 --- a/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs +++ b/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs @@ -81,7 +81,7 @@ object GetInnerDestination() } } } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/IObjectMapper.cs b/src/AutoMapper/Mappers/IObjectMapper.cs index da78ab9bdc..a0907ccd7d 100644 --- a/src/AutoMapper/Mappers/IObjectMapper.cs +++ b/src/AutoMapper/Mappers/IObjectMapper.cs @@ -68,7 +68,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p Constant(destExpression.Type), ContextParameter); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/KeyValueMapper.cs b/src/AutoMapper/Mappers/KeyValueMapper.cs index 8eacc4c991..aba9503455 100644 --- a/src/AutoMapper/Mappers/KeyValueMapper.cs +++ b/src/AutoMapper/Mappers/KeyValueMapper.cs @@ -14,7 +14,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p var mapValues = configuration.MapExpression(profileMap, values, ExpressionBuilder.Property(sourceExpression, "Value")); return New(destinationType.GetConstructor(destinationArguments), mapKeys, mapValues); } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ParseStringMapper.cs b/src/AutoMapper/Mappers/ParseStringMapper.cs index ff8dc4f81d..033926c5cd 100644 --- a/src/AutoMapper/Mappers/ParseStringMapper.cs +++ b/src/AutoMapper/Mappers/ParseStringMapper.cs @@ -6,7 +6,7 @@ public sealed class ParseStringMapper : IObjectMapper static bool HasParse(Type type) => type == typeof(Guid) || type == typeof(TimeSpan) || type == typeof(DateTimeOffset); public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) => Call(destExpression.Type.GetMethod("Parse", [typeof(string)]), sourceExpression); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ToDynamicMapper.cs b/src/AutoMapper/Mappers/ToDynamicMapper.cs index 236ede8300..7b1e37c021 100644 --- a/src/AutoMapper/Mappers/ToDynamicMapper.cs +++ b/src/AutoMapper/Mappers/ToDynamicMapper.cs @@ -39,7 +39,7 @@ private static void SetDynamically(string memberName, object target, object valu public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) => Call(MapMethodInfo, sourceExpression.ToObject(), destExpression, Constant(destExpression.Type), ContextParameter, Constant(profileMap)); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs b/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs index 5ccf55d4cb..761af30019 100644 --- a/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs +++ b/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs @@ -7,7 +7,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p Call(MembersDictionaryMethodInfo, sourceExpression.ToObject(), Constant(profileMap)); private static Dictionary MembersDictionary(object source, ProfileMap profileMap) => profileMap.CreateTypeDetails(source.GetType()).ReadAccessors.ToDictionary(p => p.Name, p => p.GetMemberValue(source)); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ToStringMapper.cs b/src/AutoMapper/Mappers/ToStringMapper.cs index b3d4ac9a54..76abc6c00b 100644 --- a/src/AutoMapper/Mappers/ToStringMapper.cs +++ b/src/AutoMapper/Mappers/ToStringMapper.cs @@ -8,7 +8,7 @@ public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap p var toStringCall = Call(sourceExpression, ObjectToString); return sourceType.IsEnum ? StringToEnumMapper.CheckEnumMember(sourceExpression, sourceType, toStringCall) : toStringCall; } -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/UnderlyingEnumTypeMapper.cs b/src/AutoMapper/Mappers/UnderlyingEnumTypeMapper.cs index 230c5a8ef9..acca725f54 100644 --- a/src/AutoMapper/Mappers/UnderlyingEnumTypeMapper.cs +++ b/src/AutoMapper/Mappers/UnderlyingEnumTypeMapper.cs @@ -5,7 +5,7 @@ public sealed class UnderlyingTypeEnumMapper : IObjectMapper public bool IsMatch(TypePair context) => context.IsEnumToUnderlyingType() || context.IsUnderlyingTypeToEnum(); public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) => sourceExpression; -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } \ No newline at end of file diff --git a/src/AutoMapper/MemberMap.cs b/src/AutoMapper/MemberMap.cs index 123b5de2c1..2a5805bccc 100644 --- a/src/AutoMapper/MemberMap.cs +++ b/src/AutoMapper/MemberMap.cs @@ -93,7 +93,7 @@ Expression IValueResolver.GetExpression(IGlobalConfiguration configuration, Memb MemberInfo IValueResolver.GetSourceMember(MemberMap memberMap) => SourceMembers[0]; Type IValueResolver.ResolvedType => SourceMembers[^1].GetMemberType(); -#if NETSTANDARD2_0 +#if FULL_OR_STANDARD public string SourceMemberName => null; public LambdaExpression ProjectToExpression => null; public IValueResolver CloseGenerics(TypeMap typeMap) => this; diff --git a/src/IntegrationTests/AutoMapper.IntegrationTests.csproj b/src/IntegrationTests/AutoMapper.IntegrationTests.csproj index 72b864934f..ccbd115d90 100644 --- a/src/IntegrationTests/AutoMapper.IntegrationTests.csproj +++ b/src/IntegrationTests/AutoMapper.IntegrationTests.csproj @@ -7,15 +7,10 @@ true - - true - $(TargetFrameworks);net462 - - - + diff --git a/src/UnitTests/ArraysAndLists.cs b/src/UnitTests/ArraysAndLists.cs index ce9eaabad8..eb02f5dd4c 100644 --- a/src/UnitTests/ArraysAndLists.cs +++ b/src/UnitTests/ArraysAndLists.cs @@ -159,7 +159,7 @@ public Expression MapExpression(IGlobalConfiguration configurationProvider, Prof MemberMap memberMap, Expression sourceExpression, Expression destExpression) => Expression.Multiply(Expression.Convert(sourceExpression, typeof(int)), Expression.Constant(1000)); -#if NET481 +#if NET471_OR_GREATER public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif } diff --git a/src/UnitTests/AutoMapper.UnitTests.csproj b/src/UnitTests/AutoMapper.UnitTests.csproj index 31e14ffddd..5e37fcc40c 100644 --- a/src/UnitTests/AutoMapper.UnitTests.csproj +++ b/src/UnitTests/AutoMapper.UnitTests.csproj @@ -9,7 +9,7 @@ true - $(TargetFrameworks);net462 + $(TargetFrameworks);net471 diff --git a/src/UnitTests/ForPath.cs b/src/UnitTests/ForPath.cs index 0c944747e6..eb45f2b165 100644 --- a/src/UnitTests/ForPath.cs +++ b/src/UnitTests/ForPath.cs @@ -254,7 +254,7 @@ public void Should_throw_exception() { var cfg = new MapperConfiguration(config => { - Assert.Throws(() => + Assert.Throws(() => { config.CreateMap() .ForPath(sourceModel => sourceModel.Name, opts => opts.MapFrom(null)); diff --git a/src/UnitTests/Mappers/CustomMapperTests.cs b/src/UnitTests/Mappers/CustomMapperTests.cs index e97b0e6230..975b5fe99c 100644 --- a/src/UnitTests/Mappers/CustomMapperTests.cs +++ b/src/UnitTests/Mappers/CustomMapperTests.cs @@ -67,7 +67,7 @@ public Expression MapExpression(IGlobalConfiguration configurationProvider, Prof return expr.Body; } -#if NET481 +#if NET471_OR_GREATER public TypePair? GetAssociatedTypes(TypePair initialTypes) => null; #endif }