-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SGen on .NET Core should point to Microsoft.XmlSerializer.Generator package #3583
Comments
New docs at https://docs.microsoft.com/dotnet/core/additional-tools/xml-serializer-generator The fix for this will probably look like #3987, which did the same thing (nicer error for a task that doesn't exist on Core) for a different task. @donJoseLuis, this might be a good starter issue for you. |
To reproduce:
Outcome: C:...\3.1.101\Microsoft.Common.CurrentVersion.targets(3544,5): error MSB4062: The "Microsoft.Build.Tasks.SGen" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\tmp\tmp.csproj] |
I see SGen failing in these scenarios:
@donJoseLuis, @rainersigwald , am I right in assuming that we want to point the developer to the new Microsoft.XmlSerializer.Generator in 2. and 1a. but not in 1b.? For 1b. we just tell them that this is not supported on the .NET Core version of MSBuild. In other words, we need to detect the platform both at our build time and at run time. |
Correct--the task is currently just not built on Core at all.
I think this actually works? But ideally yes we should emit the message there, too. I was envisioning that as out of scope for this work item, but if you wanted to be ambitious about it feel free :) |
I'm afraid 2. is also failing, although it seems to be coming from SGen itself:
Arguably, this error is even less user friendly than what you get on Core and my understanding is that this is a fairly common scenario as well since building a Core project in VS gets you here. Let's get ambitious :) |
I have opened a PR to implement an empty SGen task on Core. The other issue where SGen is failing when invoked by the Framework version of MSBuild when building a Core project is being discussed in dotnet/core#2716. |
The SGen task has not been implemented on .NET Core and building a project with `<GenerateSerializationAssemblies>` is failing with what looks like an infrastructure error. This PR is adding an empty implementation of the task which throws a nicer error pointing the user to the build-time serialization mechanism supported on .NET Core - Microsoft.XmlSerializer.Generator. The changes here are analogous to how the ResolveComReference task has been implemented to allow erroring out on Core. Fixes #3583
The SGen task has not been implemented on .NET Core and building a project with `<GenerateSerializationAssemblies>` is failing with what looks like an infrastructure error. This PR is adding an empty implementation of the task which throws a nicer error pointing the user to the build-time serialization mechanism supported on .NET Core - Microsoft.XmlSerializer.Generator. The changes here are analogous to how the ResolveComReference task has been implemented to allow erroring out on Core. Fixes dotnet#3583
In the early days of .NET Core there was no sgen, and we didn't port the sgen task.
There's a new .NET Core serializer generator: https://github.com/dotnet/corefx/issues/25138. Docs at https://github.com/dotnet/core/blob/master/samples/xmlserializergenerator-instructions.md.
We should promote that when someone attempts to use the SGen task on .NET Core. Probably just emit an error pointing to an aka.ms link to those docs?
cc @huanwu in case there's a better thing to do.
The text was updated successfully, but these errors were encountered: