Generating resources for SDK-style projects targeting net20/net35 #7590
-
|
Hi all, I've recently converted an old project to SDK-style project files since, according to the docs, supports every .NET framework from .NET 2.0 onwards, using Microsoft.NETFramework.ReferenceAssemblies. This happens on both:
There was some work done in this area for .NET Core 3.0 (#2272, #2221, docfx#8474, #4082), there is a GenerateResource MSBuild task documented in the official docs and there is also a What is the correct way to generate strongly-typed resource files for .NET 2.0/3.5 in SDK-style projects? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
To target .NET Framework 2.0/3.5 projects that use resources, you must build with The reason for this is that .NET Framework resources required using However, |
Beta Was this translation helpful? Give feedback.
To target .NET Framework 2.0/3.5 projects that use resources, you must build with
MSBuild.exe.dotnet buildis not supported for that scenario.The reason for this is that .NET Framework resources required using
BinaryFormatter, which varies between .NET versions, so we cannot create the resources from a .NET 6 process. An improved mechanism is available calledSystem.Resources.Extensions, but it supports .NET Framework 4.6.1 and higher, with no plans to support lower framework versions (dotnet/runtime#62282).However,
MSBuild.exeretains the ability to use a .NET Framework 3.5 process to create the resources, and works with .NET SDK projects. So to build this project you'll need to use t…