14

Hello everyone I got an error and I`m trying to solve it I found some similar source but could not solve my problem. Similar problem like here.

I compile my project .csproj file using .bat file actually it is .batch file from cmd. But I got this error:

error MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true. [C:\Users\rmrud\source\Workspaces\Workspace2\HAL9\v3_07\Test\Test\Test.csproj]

and also I got this:

error MSB3822: Non-string resources require the 
System.Resources.Extensions assembly at runtime, but it was not found in this project's references. [C:\Users\rmrud\source\Workspaces\Workspace2\HAL9\
v3_07\Test\Test\Test.csproj]

I also did this run this in cmd choco install visualstudio2019-workload-netcoretools.

I edited my .csproj file add these xml node in your xxx.csproj file:

<PropertyGroup> 
    <GenerateResourceMSBuildArchitecture>
        CurrentArchitecture
    </GenerateResourceMSBuildArchitecture>
    <GenerateResourceMSBuildRuntime>
        CurrentRuntime
    </GenerateResourceMSBuildRuntime>
</PropertyGroup>

then again I compile using bat file from cmd but still got build error. How to overcome this thanks in advance. Please Note that in my machine I'm using .NET framework version 4.8 and .Net core 5

zhulien
  • 5,145
  • 3
  • 22
  • 36
Rifat Murtuza
  • 1,151
  • 2
  • 7
  • 15

2 Answers2

19

Please add System.Resources.Extensions NuGet package into an appropriate project.

Anton Norko
  • 2,166
  • 1
  • 15
  • 20
2

If your project is using .NET Framework and you using Resources in it, check if you have this in your csproj file:

 <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

Remove it or set it to false. Check references for this, it seems that it's used with .NET Core but for NET Framework give false error.

Hacko
  • 1,551
  • 1
  • 15
  • 11