locked
Upgrading your source code with latest framework RRS feed

  • Question

  • User-614943948 posted

    I have an old ASP.NET application, developed in Visual Studio 2013 with .NET framework 4.0. Now I have to upgrade the source code to latest framework 4.8, using the same visual studio.

    Will it affect the whole application? What all things do i need to take care of

    Monday, March 8, 2021 12:20 PM

All replies

  • User475983607 posted

    I have an old ASP.NET application, developed in Visual Studio 2013 with .NET framework 4.0. Now I have to upgrade the source code to latest framework 4.8, using the same visual studio.

    Will it affect the whole application? What all things do i need to take care of

    We cannot see you Visual Studio solution and have no idea what .NET libraries make up your application.  Each project has a .NET target framework.  Updating the .NET framework the affect the project.  If the project is a library then projects that reference the library are affected.  

    The main thing to look out for are deprecated methods.

    First build the project targeting 4.0.  Fix any error or warnings. 

    Change the target framework to 4.8 and do a build.  Look in the "Error List" for errors and warnings.  Read the warning for more information. You might have to Google the errors since you are jumping from 4.0 to 4.8.  There were a lot of changes in 4.5.  You might want to migrate from 4.0 to 4.5 first. 

    The .NET team provides a migration guide.  Browse the guide for features you are currently using.

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

    Monday, March 8, 2021 1:00 PM
  • User-1982062310 posted

    What all things do i need to take care of

    You want to pay particular attention to library references - unless your app is very simple and doesn't use any 3rd party libraries, you're in for a fun ride.

    Which means that you will have to upgrade each library you're referencing (using NuGet) to its latest version for 4.8 framework. There's a high chance that individual APIs that your code is calling will have changed, and you will need to update your code to call new methods/supply new/different parameters.

    There's a small chance some libraries you're using haven't been updated to 4.8, in that case you still might be able to use whichever latest version you can find.

    Make sure you have plenty of unit test, so you can check that code still works after the upgrade.

    Tuesday, March 9, 2021 10:17 PM
  • User-614943948 posted

    I installed the latest framework and in web.config...

    <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
        <compilation debug="true" targetFramework="4.8">
          <assemblies>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
            <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
            <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
            <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
            <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
            <add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
          </assemblies>
          <buildProviders>
            <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
          </buildProviders>
        </compilation>
        <customErrors mode="Off" />
      </system.web>
      <system.webServer>

    Changed the target framework from 4.0 to 4.8. For now things seems to work fine with DDL and DML operation. Is there any other changes do I need to make in the web.config file?

    Wednesday, March 10, 2021 10:15 AM
  • User753101303 posted

    Hi,

    I generally do that using "Project"  "Properties" in VS rather than directly on the web.config file (you are doing that on your source code or on the deployed application ???)

    The ealier link is to show "runtime" changes ie what happens if you run a 4.0 app using the 4.8 runtime.

    If you want to recompile your 4.0 code to 4.8 you should read https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.0-4.8 once to spot possible changes. Most ofen you can revert back to the old behavior if you need some time to adjust your application to the new behavior.

    It always went well for me (though I never upgraded directly from 4.0 to 4.8). I only remember about small rendering changes for example for the menu control.

    Wednesday, March 10, 2021 12:08 PM
  • User475983607 posted

    IMHO, it's unbelievable to go from 4.0 to 4.8 without any issues.  Did you read the migration guide?

    Wednesday, March 10, 2021 12:38 PM
  • User-614943948 posted

    Yes, we are still doing the Unit testing

    Thursday, March 11, 2021 9:05 AM