Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet build produce an error: "MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime

(Ignore code type error - it was copied ree handed) The bottom line is:

The System.Resources.Extensions nuget dll is not uploading to the project runtime folder.

Here is the full story:

.Net Project FW: 4.6.1. Project is built successfully using the VS build command, but fails when trying to run the dotnet build command, getting the errors:

error MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true.

MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references".

So, I edited the csproj file and added: <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

I installed nuget netStandard 2.0, and then installed nuget System.Resources.Extensions version 6.0.0. Now I build he project using dotnet build cli and for some reason the System.Resources.Extensions dll is not uploading into the project runtime folder, so I get the error:

MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references".

How can I solve it ? (can't upgrade the project .NET version)

like image 223
Guy E Avatar asked Oct 21 '25 11:10

Guy E


1 Answers

I ran into this issue while setting up CI/CD for a project on Bamboo. A previous Windows agent could build this project fine using dotnet build, but a new agent I had set up with the exact same toolset could not. The project would build fine on either machine under the IDE.

It turns out the only difference was the System.Resources.Extensions was installed into the nuget cache on the machine that worked.

To fix the issue, I opened visual studio as the user who the CI agent runs under, and used the NuGet package manager to install the correct System.Resources.Extensions version for the .NET target that my project used. Since the .NET project targeted 4.8, I installed 8.0.0. of System.Resources.Extensions. I did not need to modify the project, only to have the assemblies in the NuGet local cache.

You can find System.Resources.Extensions here Link to Nuget.Org, along with instructions for installing. Make sure to choose the appropriate version for your .NET target.

like image 50
ehambright Avatar answered Oct 23 '25 00:10

ehambright



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!