Skip to content
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

System.Xml RoslynCodeTaskFactory Build Problem macOS #2700

Closed
listm opened this issue Nov 12, 2024 · 2 comments · Fixed by #2714
Closed

System.Xml RoslynCodeTaskFactory Build Problem macOS #2700

listm opened this issue Nov 12, 2024 · 2 comments · Fixed by #2714
Labels
Milestone

Comments

@listm
Copy link

listm commented Nov 12, 2024

Since commit ecebd97, the Eto.Platform.Mac64.targets does not work on our Mac build machine anymore. After hours of looking, I could manually add a reference to System.Xml, now it works.

We will migrate to .NET some time soon, but currently still use Mono for building and as runtime.

Expected Behavior

Bundle build on macOS using Mono works

Actual Behavior

Error on macOS using Mono 6.12.0 when running msbuild MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj '-p:Configuration=Release'. On Windows, it works.

System.Xml assembly seems to be missing or incomplete. It does not help, when I add any System.Xml references using NuGet.

"/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj" (default target) (1) ->
"/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj" (Build target) (1:2) ->
(MacFinishBundle target) -> 
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(25,7): error CS1069: The type name 'XmlDocument' could not be found in the namespace 'System.Xml'. This type has been forwarded to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(26,7): error CS1069: The type name 'XmlNode' could not be found in the namespace 'System.Xml'. This type has been forwarded to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(28,39): error CS1069: The type name 'XmlTextWriter' could not be found in the namespace 'System.Xml'. This type has been forwarded to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(30,9): error CS1069: The type name 'XmlWriterSettings' could not be found in the namespace 'System.Xml'. This type has been forwarded to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(45,43): error CS0115: 'UpdatePList.NullSubsetXmlTextWriter.Settings': no suitable method found to override [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(47,30): error CS0115: 'UpdatePList.NullSubsetXmlTextWriter.WriteDocType(string, string, string, string)': no suitable method found to override [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp(45,25): error CS1069: The type name 'XmlWriterSettings' could not be found in the namespace 'System.Xml'. This type has been forwarded to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /Users/etolover/.nuget/packages/eto.platform.mac64/2.8.3/build/Eto.Platform.Mac64.targets(236,5): error : The source file for this compilation can be found at: "/var/folders/c7/zxpfd0zs0djd105tg16ftrw80000gn/T/tmp2760bebe.tmp" [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]
  /Users/etolover/.nuget/packages/eto.platform.mac64/2.8.3/build/Eto.Platform.Mac64.targets(236,5): error MSB4175: The task factory "RoslynCodeTaskFactory" could not be loaded from the assembly "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property. [/Users/etolover/Source/myproject/MyHybridGui/MyHybridGui.Desktop/MyHybridGui.Desktop.csproj]


Steps to Reproduce the Problem

  1. I did not try this on other machines or with a fresh project.

Code that Demonstrates the Problem

Code that solved the Problem on my machine

 % grep -C3 System.Xml /Users/etolover/.nuget/packages/eto.platform.mac64/2.8.3/build/Eto.Platform.Mac64.targets   
    </ParameterGroup>
    <Task>
      <Reference Include="netstandard"/>
      <Reference Include="System.Xml"/>
      <Code Type="Class" Language="cs"><![CDATA[
    using System;
    using System.IO;
    using System.Xml;
    using System.Text;
    using Microsoft.Build.Framework;
    using Microsoft.Build.Utilities;

Specifications

  • Version: 2.8.3

  • Platform(s): Mac64

  • Operating System(s): macOS Sonoma 14.7.1 on Apple M2 (Mac mini 2023)

  • MsBuild Version: Microsoft (R) Build Engine version 16.10.1 for Mono

  • mono --version: Mono JIT compiler version 6.12.0.188 (2020-02/ca8abcb6bc4 Thu Oct 13 14:26:22 EDT 2022)

@listm
Copy link
Author

listm commented Nov 12, 2024

Hi! I don't know if this is just our machine configuration or really a problem with the Eto.Platform.Mac64.targets file. In case you need more information or a project to reproduce, I can add additional information.
But I wanted to write this done as long as it's fresh in my memory. Maybe it can at least help someone else.

I don't know if adding <Reference Include="System.Xml"/> to Mac.targets will destroy the build on other systems, so I have not created a pull request. And I don't know if the reference was removed intentionally, or by accident.

Thank you!

@cwensley
Copy link
Member

Hey @listm,

Thanks for reporting the issue, but I have removed support of using mono to compile Eto so I can use newer language features, etc. I have not removed support for using mono runtime, however that should also be considered obsolete and I would recommend getting over to using .NET Core sooner rather than later.

As for this particular issue, adding that line unfortunately causes this error when building using .NET Core SDK:

.../Eto/src/Eto.Mac/build/Mac.targets(237,5): error MSB3755: Could not find reference "System.Xml"

.. so in order to support using mono to build, it'd have to only conditionally add that reference in that case. I've created a PR to fix that shortly since it wasn't a huge change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants