Skip to content

Warnings during build .net core project #638

Closed

Description

@jincod

Hi!

Thank you for your project.

I'm using FluentValidation.AspNetCore 7.2.1.

I have warnings during build:

C:\Program Files\dotnet\sdk\2.1.2\Microsoft.Common.CurrentVersion.targets(2041,5): warning MSB3277: Found conflicts between different versions of "Microsoft.Win32.Registry" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. [d:\Projects\FluentValidationBuildWarnings\FluentValidationBuildWarnings.csproj]

C:\Program Files\dotnet\sdk\2.1.2\Microsoft.Common.CurrentVersion.targets(2041,5): warning MSB3277: Found conflicts between different versions of "System.Security.Principal.Windows" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. [d:\Projects\FluentValidationBuildWarnings\FluentValidationBuildWarnings.csproj]

Issue demonstration: https://github.com/jincod/FluentValidationBuildWarnings

Unfortunately, I did find cause of this behavior.

Activity

  1. JeremySkinner commented on Dec 7, 2017

    @JeremySkinner
    Member

    Hi, that's not really related to FluentValidation, but is caused by mixing different netstandard versions in the same project.

    As the message says, setting the build log to detailed will show you what's happening. Essentially it's complaining because you're targetting netstandard2.0 but you're bringing in Microsoft.AspNetCore.Mvc 1.1 which targets netstandard1.6 and the .net sdk it's getting confused between different version of mscorlib (the .net core build process is still pretty buggy)

    Nuget is bringing in microsoft.aspnetcore.mvc 1.1 because that's the minimum version supported by FluentValidation. But your project is targetting netstandard2.0, so you should be referencing microsoft.aspnetcore.mvc 2.0 instead. Add the following to your project and you'll see the warning goes away:

    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
    

    Alternatively if you actually meant to work with mvc 1.1 then you can safely ignore the warning if you don’t want to downgrade to netstandard 1.6. It don’t believe it actually causes any issues.

  2. JeremySkinner commented on Dec 7, 2017

    @JeremySkinner
    Member

    Also; if you upgrade to FluentValidation 7.3-beta2 you’ll see this doesn’t happen as it’s metadata explicitly targets different versions of Microsoft.AspNetCore.Mvc depending on which netstandard version you’re running on. So going forward you won’t run into this.

  3. jincod commented on Dec 7, 2017

    @jincod
    Author

    FluentValidation 7.3-beta2 works for me

    Thanks a lot!

  4. locked and limited conversation to collaborators on Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions