Why does Visual Studio silently drop references when updating a project's .NET Framework version?

Robert Abraham 21 Reputation points
2020-11-20T15:11:05.433+00:00

I'm running Visual Studio 2019. I opened a solution, and updated one of the projects in it from .NET Framework 4.6 to .NET Framework 4.7.2.

I noticed that, after updating the .NET version, several references in the project were removed. I'm guessing that those references aren't compatible with .NET 4.7.2, but I'd like to find some documentation that confirms this behavior. So a few questions:

1) Were these references removed due to .NET version incompatibilities? Is there documentation that explains this?

2) Is there a record of these removed dependencies?

Possibly relevant context: We use Paket as our dependency manager.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,130 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 30,651 Reputation points Microsoft Vendor
    2020-11-23T07:35:53.647+00:00

    Hello @Robert Abraham ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Were these references removed due to .NET version incompatibilities? Is there documentation that explains this?

    Newer versions of .NET Framework have improved and fixed some issues from the previous versions, and add some newly features. As you mentioned above, this will cause some incompatible issues, but normally, this process just modify the version of .NET Framework(change some .NET Framework files, instead of changing or removing other references).

    For migrating from .NET Framework 4.6 to .NET Framework 4.7.2, you can refer to this document: Retargeting Changes for Migration from .NET Framework 4.6 to 4.7.2. Actually, I will suggest you refer to this document: Migrate to .NET Framework 4.8, 4.7,4.6, and 4.5 before migrating from .NET Framework 4.6 to .NET Framework 4.7.2(I noticed that you have updated). Of course, for some third-party extensions or dlls files, references… not sure if they support the newly version of .NET Framework. I suggest you can also confirm this from the related official websites or authors if you use some of them and some of them are removed(Perhaps, Paket helped to remove and arrange some references).

    Is there a record of these removed dependencies?

    I’m afraid, normally, there isn’t a record. If you just change the target framework, you can try to change it back and see if this recovers some references.

    Sincerely,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

  2. Perry Qian-MSFT 6 Reputation points
    2020-12-03T09:01:37.183+00:00

    Hi @Robert Abraham ,

    Actually, this is a problem of net framework 4.7.2 version itself. This new version has make some improvements.

    For example, some systems or DLLS already in the GAC are no longer copied into the build folder to improve the efficiency of the build and to lighten the build results. So that's a big improvement.

    If my guess is correct,you can try to add this node in csproj file to make them back.

    <PropertyGroup>  
      < CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>  
    </PropertyGroup>  
    

    Best Regards,

    Perry


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.