Build automation - Deployment Center - failing System.Text.Json 8.0.0.4 - Including fix C# ASP.NET

Poelder, Niels 0 Reputation points
2024-11-25T15:42:56.3866667+00:00

I have getting an error with my latest build using DotNet 8.0 when using the "Deployment Center" on Azure which is connected to my git repo. I couldn't find a fix specifically online so I dug deeper and through trail and error I've come to this solution.

..... Could not load file or assembly 'System.Text.Json, Version=8.0.0.4,	

Regardless of SDK version you have selected as preffered, it seems to auto want to go for sdk version 9 of DotNet wich may not be desired.

I have come up with a simple workaround:

  1. Check out your versions of the DotNet in your application using console.
    afbeelding
  2. Create a global.json file with the following code:
       {  
        "sdk": {
           "version": "8.0.400" // Put your version here   
       	}
       }
    
  3. Commit and push the changes for the Deployment Center to run the auto build and now it should build :)
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,663 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,091 questions
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Deployment: The process of delivering, assembling, and maintaining a particular version of a software system at a site.
1,006 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,000 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 67,916 Reputation points
    2024-11-25T16:21:30.3166667+00:00

    System.Text.Json 8.0.0.4 has a security vulnerability and should not be used. 9 is the current version for all frameworks. You should update your nuget package references in the application project.


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.