dotnet build stops on a .NET Framework project with image resources
Your error
error MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references.1 more line it can showFix it fast
Most common cause, 1 of 3dotnet build meets image resources with neither setting in place
Turn on preserialized resources and reference the package in the .csproj that owns the .resx file.
<PropertyGroup>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Resources.Extensions" Version="11.0.0" />
</ItemGroup>Short answer
MSB3822 means dotnet build met a .resx file with non-string data, such as WinForms images or icons, in a .NET Framework project. The .NET SDK's MSBuild can only embed that data preserialized, which needs System.Resources.Extensions at runtime. Set GenerateResourceUsePreserializedResources to true and reference the package, or build with Visual Studio's MSBuild.exe instead.
Which cause do you have?
Save one build log and look at which resource errors it holds, then look for the property, the package and a packages.config file. MSB3823 next to MSB3822 points to cause 1, MSB3822 on its own to cause 2, and a packages.config file to cause 3.
dotnet build 2>&1 | tee build.log
grep -nE "MSB382[23]|MSB3245" build.log
grep -rnE "GenerateResourceUsePreserializedResources|System.Resources.Extensions" --include=*.csproj .
ls packages.configThen find the line you see in this list and open its fix:
- 1dotnet build meets image resources with neither setting in place
MSB3823 and MSB3822 both appear for the same .resx file - 2The property is on, but the package never reaches this project
MSB3823 is gone and MSB3822 remains - 3An old-style project lists the package in packages.config
packages.config sits next to the .csproj, and the log also shows MSB3245 for System.Resources.Extensions
What does the error look like?
error MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references.error MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true.
Cause 1 of 3
dotnet build meets image resources with neither setting in place
You seeMSB3823 and MSB3822 both appear for the same .resx file
Check
MSB3822 together with MSB3823 means the SDK's MSBuild found non-string data in a .resx file and the project has neither the preserialized property nor the package. Only Visual Studio's MSBuild.exe can still embed such data the old way; MSBuild running on .NET supports the preserialized method alone.
grep -rn "GenerateResourceUsePreserializedResources" --include=*.csproj .Fix
Turn on preserialized resources and reference the package in the .csproj that owns the .resx file. If you would rather not ship an extra DLL, leave the property out and build that project with Visual Studio or MSBuild.exe instead of dotnet build.
<PropertyGroup>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Resources.Extensions" Version="11.0.0" />
</ItemGroup>Verify
The build log has no MSB382x lines, and System.Resources.Extensions.dll lands in the output folder, ready for the app to load at runtime.
dotnet build
find bin -name "System.Resources.Extensions.dll"Confirmed by learn.microsoft.com
Cause 2 of 3
The property is on, but the package never reaches this project
You seeMSB3823 is gone and MSB3822 remains
Check
A lone MSB3822 says the preserialized path is switched on, yet no assembly named System.Resources.Extensions sits in the references given to the GenerateResource task. MSBuild compares the resolved references by assembly name, so the package has to resolve for the very project that compiles the .resx file.
dotnet package list --include-transitive | grep -i Resources.ExtensionsFix
Add the PackageReference to that project's .csproj and build again. On a .NET 9 SDK or older, the list command above is spelled dotnet list package.
<ItemGroup>
<PackageReference Include="System.Resources.Extensions" Version="11.0.0" />
</ItemGroup>Verify
The package list now shows System.Resources.Extensions for the project, and the build ends without MSB3822.
dotnet build 2>&1 | grep -c MSB3822Confirmed by learn.microsoft.com
Cause 3 of 3
An old-style project lists the package in packages.config
You seepackages.config sits next to the .csproj, and the log also shows MSB3245 for System.Resources.Extensions
Check
With a packages.config project, MSB3822 can stay after you install the package, because dotnet restore only reads PackageReference items. The .csproj then points with a HintPath into a packages folder that nothing restored, MSB3245 reports the reference as unresolved, and GenerateResource still finds no System.Resources.Extensions.
grep -n "System.Resources.Extensions" packages.configFix
Move the project to PackageReference: in Visual Studio, right-click packages.config and choose Migrate packages.config to PackageReference. If it has to stay on packages.config for now, restore it with MSBuild before each dotnet build.
msbuild -t:restore -p:RestorePackagesConfig=true
dotnet buildVerify
The packages folder holds System.Resources.Extensions, the MSB3245 warning is gone, and the build succeeds.
dotnet build 2>&1 | grep -E "MSB3245|MSB3822"Confirmed by learn.microsoft.com
How do I stop it coming back?
- Put the property and the PackageReference next to each other in the same .csproj, so a copy of one never travels without the other.
- Convert packages.config projects to PackageReference before you move their CI builds from MSBuild.exe to the dotnet CLI.
- Make the CI build use the same engine as your developers, so a resource that builds in Visual Studio cannot fail only on the build agent.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Raheeb, Loade Driver, Dhero.