locked
Upgrade target framework from 2.0 to 4.7.2 in visual studio 2019 enterprise edition RRS feed

  • Question

  • User-257070954 posted

    Hi All,

              I am an installed visual studio 2019 enterprise edition in my System.  I am trying to create one web API project. In my solution, I had one normal project and three class library projects for the Business layer, Model and Data access layer. Here my problem is when the right-clicking data access layer project and try to give reference to assemblies that section is empty and showing the target framework is 2.0.  When I do same thing normal project its showing target frame is 4.7.2 and listing item in assemblies section. So my question is how to upgrade my data access layer project target framework from 2.0  to 4.7.2.  OR how can I list items in assemblies section when I give a reference from the Data Access layer

    Friday, August 23, 2019 6:55 AM

All replies

  • User475983607 posted

    It is very simple to change the .NET framework target using project properties.  You might need to update deprecated code.  Doing a build with while targeting .NET 4.7.2 will expose warning and errors.  You'll need to read the error and any associated reference documentation to make sure upgrading correctly.

    Also MS provides migration guides.

    https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/

    Friday, August 23, 2019 10:25 AM
  • User-474980206 posted
    Most likely you picked .net standard 2.0 for the data access layer. This uses a different project file format than the previous versions of .net. You will need to recreate the project or hand edit the project file if you want to downgrade to 4.7.2


    Note: as the .net 4.* is at end of life (no updates planned) it would be a good practice to use .net standard for all your new libraries, as this will make them compatible with .net 5.*
    Saturday, August 24, 2019 10:10 PM