none
Code analysis conflicts RRS feed

  • Question

  • Hello,

    I have a solution with multiple .net core projects in C# using Visual Studio 2019. the projects targeting net472 when I build the solution I get warning conflicts on Microsoft code analysis. how to target the correct version? any help  would be appreciated 

    16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "Microsoft.CodeAnalysis" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
    16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "Microsoft.CodeAnalysis.CSharp" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
    16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Reflection.Metadata" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
    16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Runtime.CompilerServices.Unsafe" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
    16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.ValueTuple" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.


    Bassam wassouf


    Wednesday, September 4, 2019 1:30 PM

All replies

  • Hi Bassam,

    Welcome to the MSDN forum.

    According to your description, it seems that they are some issues with conflicting nuget package versions. 

    Try these:

     1.  update the nuget packages which is list in the output window.

     2.  find csproj or web config and log the contents of the warning and check for references and references to other projects that use the same common assembly with different versions and keep them in the same version. Just like this:

    <Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
    <Reference Include="Microsoft.Build.Framework" />
    
    
     change to
    
    <Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
    <Reference Include="Microsoft.Build.Framework, Version=12.0.0.0, ..." />

     3. set the build log file verbosity option to Diagnostic and if it turns the missing warning, try to download it by using nuget and reference the assembly contained therein.

    > > If three above does not work, maybe you should remove the references and reinstall them.

    More information you can refer to this.

    Hope it could help you.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com



    Thursday, September 5, 2019 4:26 AM
  • Hi Bassam,

    Did your issue solve or do you have any update? 

    If it does not work, please try to add a bindingRedirect node in your web.config file.

    Without the bindingRedirect , the Microsoft.* assemblies would try to load an old version of the System.* assemblies, which would fail. Just like this:

    <dependentAssembly>
                <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
            </dependentAssembly>

    BTW, you can refer to this article for more information

    https://stackoverflow.com/questions/16920370/why-is-a-bindingredirect-added-to-the-app-config-file-after-adding-the-microso

    Any feedback will be expected.

    Best Regards,

    Perry



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, September 10, 2019 9:40 AM