Msbuild: Preserialized resources error fires when not required

Created on 27 Jun 2019  路  7Comments  路  Source: dotnet/msbuild

See https://github.com/dotnet/corefx/pull/38964#discussion_r297945596

To reproduce, exclude System.Resources.Extensions.dll (either through DisableImplicitFrameworkReferences and manually adding references, or subtracting it with a target) from a netcoreapp3.0 project, add a resource with only string resources and build.

Expect: No Error

Actual: Error about missing S.R.E

Tasks Breaking Change GenerateResource regression

Most helpful comment

Thanks for confirming; that's the expected behavior, because the resources were in fact being corrupted and would fail at runtime.

All 7 comments

/cc @rainersigwald @nguerrera

So it turns out this is causing an error in File -> New Project. System.Resources.Extensions is not part of the base shared framework, it's only part of Windows Desktop. This needs to be fixed ASAP. /cc @livarcocc

@nguerrera is looking into this for 3.0 P7 and 16.3 P1.

Should I ever see this error when building for net462? This started happening after installing the .net 3 SDK preview 8. The project actually has non-string resources; so I referenced the System.Resources.Extensions nuget package and set GenerateResourceUsePreserializedResources to true and it built again (after some back and forth). But I would question whether updating msbuild should require changes like this to framework projects.

If you were building using dotnet build, any non-string resources were being corrupted and turned into strings with the value equal to how it was serialized in the resx. That was bogus and we had a lot of reports of it.

If you were building with msbuild.exe or VS, then it would have worked and should still work without the property or reference. If you see this error in VS or using msbuild.exe to build for net462 without any project changes, then there's a bug.

This is strictly a breaking change which should go in release notes. @kathleendollard

Building with VS still works with no changes. Building with dotnet (we do that on the build server) worked (as in no compiler error - I don't know if the resources got corrupted). This now doesn't work anymore unless the dependency and the option are added.

Thanks for confirming; that's the expected behavior, because the resources were in fact being corrupted and would fail at runtime.

Was this page helpful?
0 / 5 - 0 ratings