-
Notifications
You must be signed in to change notification settings - Fork 432
Build error when using "Generate serialization assembly" option in a .NET Standard class library project #418
Comments
@zhenlan do you know who to route this question to? |
@mizbrodin I suspect what is triggered by GenerateSerializationAssemblies option is the sgen.exe for full .NET Framework. It won't work for .NET Core/.NET Standard assemblies. We are working in progress a solution for Core. You can find more details from dotnet/corefx#4561. |
@zhenlan I have this problem even when I try to use this option with any .NET Framework class library project having a reference to a library targeting .NET Standard 2.0. Is this an expected behaviour as well? |
@mizbrodin I think your scenario (full .NET lib referencing NS lib) is valid. It's the desktop sgen.exe that has no idea of what netstandard.dll is. We will have to take a closer look to understand what exactly went wrong. Thanks for reporting the issue! |
@zhenlan Thank you. Can you confirm if we will be able to use GenerateSerializationAssemblies option in my .NET Standard 2.0 class library projects when the issue dotnet/corefx#4561 is solved? Will your solution for .NET Core work automatically for .NET Standard projects as well? |
Yes, dotnet/corefx#4561 will work for both .NET Core and .NET Standard projects. We are still working on the end user experience. The reason GenerateSerializationAssemblies option works for full .NET is because desktop SGEN's MsBuild target ships with MsBuild/VS. The new .NET Core/Standard SGEN will likely be a standalone NuGet package and a user needs to install it to a project. I hope the experience can be as simple as possible, but I am not sure if it can be the same. |
Is this going to be released as a separate NuGet package / build task or is it just going to be part of the SDK? I am hitting problems with the current SGen from a 'legacy' project targeting net461 that imports netstandard2 because of dependencies and now the original SGen task fails. |
@CZEMacLeod we just released a nuget package, Microsoft.XmlSerializer.Generator, which is for pre-generating XmlSerializer on .Net Core and .Net Standard. Please see the announcement for more details. We are actively looking to improve the tool and your input is a valuable part of the process. |
Closing for lack of traction, @mizbrodin please reopen if you're still having problems. |
Hello,
I'm using Visual Studio 2017 Preview (15.3.0 Preview 3.0) and Microsoft .NET Core SDK 2.0.0 Preview 2.
When I try to build a class library project targeting .NET Standard 2.0 and having GenerateSerializationAssemblies option set to On, I get the following build error:
The same happens if I'm using this option in a class library targeting .NET Framework 4.6.1 but referencing a .NET Standard 2.0 library.
Is this an expected behaviour?
The text was updated successfully, but these errors were encountered: