locked
convert web.config to appsettings.json in asp.net core RRS feed

  • Question

  • User190551098 posted

    Hi Team,

    I am doing migration asp.net project 4.5 framework to asp.net core 3.1

    how to convert web.config to appsettings.json in asp.net core 

    any suggestion and help will be highly appreciated on how to proceed further on this.
    Regards

    Monday, May 25, 2020 12:48 PM

All replies

  • User475983607 posted

    omsaisaanvi

    Hi Team,

    I am doing migration asp.net project 4.5 framework to asp.net core 3.1

    how to convert web.config to appsettings.json in asp.net core 

    any suggestion and help will be highly appreciated on how to proceed further on this.
    Regards

    Read the official ASP.NET Core configuration documentation; https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1

    You have to understand that ASP.NET Core is vastly different than 4.5.  There's no direct migration because configuration in Core commonly uses constructor injection and options passed in middleware.  I recommend going through the ASP.NET Core fundamental documentation and practicing. 

    Monday, May 25, 2020 1:00 PM
  • User1120430333 posted

    Hi Team,

    I am doing migration asp.net project 4.5 framework to asp.net core 3.1

    how to convert web.config to appsettings.json in asp.net core 

    any suggestion and help will be highly appreciated on how to proceed further on this.
    Regards

    Legacy ASP.NET Web solution uses a Web.config that is XML based and .NET Core uses Json based ap..config file. So what is happening in a Web.config you will now need to learn how to create and work with a Json based app.config.

    Monday, May 25, 2020 2:51 PM
  • User711641945 posted

    Hi omsaisaanvi,

    How did you configure your web.config?

    You could refer to the official document to migrate to asp.net core step by step:

    https://docs.microsoft.com/en-us/aspnet/core/migration/configuration?view=aspnetcore-2.2

    If you want a tool to convert automatically,the following link may give you some thoughts:

    https://andrewlock.net/converting-web-config-files-to-appsettings-json-with-a-net-core-global-tool/

    Best Regards,

    Rena

    Tuesday, May 26, 2020 8:54 AM
  • User190551098 posted

    Hi Team,

    but this is not answer I am looking for if we have 100 parameter in web.config then need to write manually all in appsetting.json it required a lot of rework

    do we have any tool to convert please suggest

    Wednesday, May 27, 2020 6:31 PM
  • User475983607 posted

    but this is not answer I am looking for if we have 100 parameter in web.config then need to write manually all in appsetting.json it required a lot of rework

    do we have any tool to convert please suggest

    Your response indicates that you've made little effort to understand ASP.NET Core as recommended.  The most likely scenario is you'll have to change every bit of code that reads the web.config.   IMHO, the web.config is a small part of the overall changes that are needed to migrate.

    Anyway, Rena Ni provided a link to a tool that converts a web.config file to appsettings.json.

    Wednesday, May 27, 2020 6:42 PM