locked
How to remove the duplicate reference for Microsoft.Build.Framework? RRS feed

  • Question

  • User-609535877 posted

    I installed Report Viewer 15 and uninstalled the previous version of Report Viewer 11 fromm NuGet Package Manager on VS 2019. I checked the webconfig and Reference all pointing to version 15 but get following error when run the code on VS 2019. How to remove the duplicate reference for Microsoft.Build.Framework?

    Compiler Error Message: CS1703: An assembly with the same identity 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has already been imported. Try removing one of the duplicate references.

    This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

    c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build.Framework\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Framework.dll: error CS1703: An assembly with the same identity 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has already been imported. Try removing one of the duplicate references.
    c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build.Framework\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Framework.dll: (Location of symbol related to previous error)

    Tuesday, April 21, 2020 12:39 PM

Answers

  • User288213138 posted

    Hi zhao790,

    An assembly with the same identity 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has already been imported. Try removing one of the duplicate references.

    For this error, you can try the following:

    One is to delete the cached nuget package, the address of the cache package is located at 

    C:\Users\[user name]\.nuget\packages

    The other is to use app.config to specify the version of nuget. about how to redirect assembly versions you can refer to this link:

    https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

    Best regards,

    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 22, 2020 2:12 AM