Share via

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 :)
Microsoft Security | Intune | Configuration Manager | Deployment
Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

Developer technologies | C#
Developer technologies | 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.

Developer technologies | ASP.NET Core | Other

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 84,071 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.

    Was this answer helpful?


Your answer

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