Eto: Unter Linux kann kein trivialer Fall erstellt werden

Erstellt am 6. Apr. 2018  ·  16Kommentare  ·  Quelle: picoe/Eto

Erwartetes Verhalten

Ich kann mit dotnet bauen

Tatsächliches Verhalten

Ich kann nicht mit dotnet bauen

Schritte zum Reproduzieren des Problems

  1. Installieren Sie dotnet-sdk-2.0.0
  2. monodevel installieren
  3. Mono-Complete installieren
  4. dotnet new -i "Eto.Forms.Templates::*"
  5. dotnet neu etoapp -g -sln
  6. dotnet-Wiederherstellung
  7. dotnet-Build

Code, der das Problem demonstriert

[alan<strong i="19">@localhost</strong> Testing]$ dotnet new etoapp -g -sln
The template "Eto App" was created successfully.
[alan<strong i="20">@localhost</strong> Testing]$ dotnet restore
  Restoring packages for /home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj...
  Restoring packages for /home/alan/Documents/Testing/Testing/Testing.csproj...
  Generating MSBuild file /home/alan/Documents/Testing/Testing.Desktop/obj/Testing.Desktop.csproj.nuget.g.props.
  Generating MSBuild file /home/alan/Documents/Testing/Testing.Desktop/obj/Testing.Desktop.csproj.nuget.g.targets.
  Generating MSBuild file /home/alan/Documents/Testing/Testing/obj/Testing.csproj.nuget.g.props.
  Generating MSBuild file /home/alan/Documents/Testing/Testing/obj/Testing.csproj.nuget.g.targets.
  Restore completed in 302.81 ms for /home/alan/Documents/Testing/Testing/Testing.csproj.
  Restore completed in 296.78 ms for /home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj.
[alan<strong i="21">@localhost</strong> Testing]$ dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Testing -> /home/alan/Documents/Testing/Testing/bin/Debug/netstandard1.6/Testing.dll
  Testing.Desktop -> /home/alan/Documents/Testing/Testing.Desktop/bin/Debug/net461/Testing.Desktop.exe
  Creating Testing.Desktop.app in target directory
/home/alan/.nuget/packages/eto.platform.mac64/2.4.0/build/MacTemplate.targets(115,3): error : MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild. [/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj]
/home/alan/.nuget/packages/eto.platform.mac64/2.4.0/build/MacTemplate.targets(115,3): error MSB4036: The "_UpdatePList" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/share/dotnet/sdk/2.0.0" directory. [/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj]

Build FAILED.

/home/alan/.nuget/packages/eto.platform.mac64/2.4.0/build/MacTemplate.targets(115,3): error : MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild. [/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj]
/home/alan/.nuget/packages/eto.platform.mac64/2.4.0/build/MacTemplate.targets(115,3): error MSB4036: The "_UpdatePList" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/share/dotnet/sdk/2.0.0" directory. [/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.csproj]
    0 Warning(s)
    2 Error(s)

Besonders diese Zeile erscheint wichtig.
The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild.

Spezifikationen

  • Version: 2.4.0
  • Plattform(en): (Fedora Gtk3)

Hilfreichster Kommentar

@voronoipotato Erstellen Sie die .csproj-Datei, nicht die Lösungsdatei. Die Lösung scheint das Mac-Projekt zu enthalten, und das wird immer nicht auf Linux aufbauen können.

Hinweis: Dies wird nicht empfohlen, da einige Funktionen fehlen oder auf Net Core nicht funktionieren, z. B. WebView. @cra0zy könnte dir mehr darüber erzählen.

Nein .... alles funktioniert auf .NET Core, einschließlich WebView.

Alle 16 Kommentare

Danke, dass Sie das Problem gemeldet haben. Sie müssen jedoch msbuild anstelle von dotnet build verwenden.

Das hat funktioniert. Als ich dasselbe für F # versuchte
dotnet new etoapp -g -sln -lang F#
dann bekomme ich

/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.fsproj(124,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ../packages/Eto.Forms.2.4.0/build/Eto.Forms.targets.
Done Building Project "/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.fsproj" (default targets) -- FAILED.
Done Building Project "/home/alan/Documents/Testing/Testing.sln" (default targets) -- FAILED.

Build FAILED.

"/home/alan/Documents/Testing/Testing.sln" (default target) (1) ->
"/home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.fsproj" (default target) (3) ->
(EnsureNuGetPackageBuildImports target) -> 
  /home/alan/Documents/Testing/Testing.Desktop/Testing.Desktop.fsproj(124,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ../packages/Eto.Forms.2.4.0/build/Eto.Forms.targets.

    0 Warning(s)
    1 Error(s)

mit msbuild.

Wir sollten wahrscheinlich in die Schnellstartanleitung aufnehmen, dass Sie dotnet build nicht verwenden können.

@voronoipotato nuget restore .
Der NuGet-Befehl sollte mit Mono-Complete installiert werden, aber wenn dies nicht der Fall ist, können Sie ihn separat installieren.

Wenn Sie nur die Linux-Plattform unterstützen müssen, können Sie Eto.Platform.Gtk nuget verwenden und auf netcoreapp2.0 abzielen, und Sie können mit dotnet build erstellen

Hier ist ein Beispiel für mein csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Eto.Platform.Gtk" Version="2.4.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Eto.Desktop\Eto.Desktop.csproj" />
  </ItemGroup>

</Project>

Hinweis: Dies wird nicht empfohlen, da einige Funktionen fehlen oder auf net core nicht funktionieren, zum Beispiel WebView .

@voronoipotato Erstellen Sie die .csproj-Datei, nicht die Lösungsdatei. Die Lösung scheint das Mac-Projekt zu enthalten, und das wird immer nicht auf Linux aufbauen können.

Hinweis: Dies wird nicht empfohlen, da einige Funktionen fehlen oder auf Net Core nicht funktionieren, z. B. WebView. @cra0zy könnte dir mehr darüber erzählen.

Nein .... alles funktioniert auf .NET Core, einschließlich WebView.

Die Lösung scheint das Mac-Projekt zu enthalten, und das wird immer nicht auf Linux aufbauen können.

Eigentlich ist das falsch. Die Mac-Projekte verwenden nicht mehr den veralteten MonoMac-Projekttyp und verwenden csproj im SDK-Stil. Die Nuget-Pakete von Eto enthalten jetzt .targets-Dateien, die das .app-Bundle sogar unter Windows oder Linux für Sie erstellen. Das optionale Xamarin.Mac-Projekt wird jedoch weiterhin nur auf einem Mac erstellt.

Wir sollten wahrscheinlich in die Schnellstartanleitung aufnehmen, dass Sie dotnet build nicht verwenden können

Getan! Ich habe dem Beispiel nuget restore und msbuild hinzugefügt, um die Leute dort in die richtige Richtung zu weisen.

Ah, ich dachte, er generiert die Lösungen pro Plattform, habe die neuen Vorlagen noch nicht wirklich ausprobiert.

@voronoipotato funktioniert das jetzt für dich mit nuget/msbuild?

Ich habe auch #1080 erstellt, um die .targets-Dateien so zu portieren, dass sie in Zukunft dotnet build unterstützen.

Auch ich bin nicht in der Lage, einen trivialen Fall zu bauen.

Schritte zum Reproduzieren

mkdir -p eto-test
cd eto-test
dotnet new -i "Eto.Forms.Templates::*"
dotnet new etoapp -lang F#
nuget restore
msbuild

Was geschieht

Microsoft (R) Build Engine version 15.4.0.0 ( Wed Nov 29 14:47:19 UTC 2017) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 4/13/2018 9:34:26 AM.
Project "[…]/eto-test/eto-test.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Any CPU".
Project "[…]/eto-test/eto-test.sln" (1) is building "[…]/eto-test/eto-test/eto-test.fsproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "bin/Debug/net45/".
  Creating directory "obj/Debug/net45/".
/usr/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '[…]/eto-test/eto-test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [[…]/eto-test/eto-test/eto-test.fsproj]
  Build continuing because "ContinueOnError" on the task "ReportAssetsLogMessages" is set to "ErrorAndContinue".
/usr/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '[…]/eto-test/eto-test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [[…]/eto-test/eto-test/eto-test.fsproj]
Done Building Project "[…]/eto-test/eto-test/eto-test.fsproj" (default targets) -- FAILED.
Project "[…]/eto-test/eto-test.sln" (1) is building "[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj" (3) on node 1 (default targets).
GenerateFSharpTextResources:
  Creating directory "obj/Debug/".
PrepareForBuild:
  Creating directory "bin/Debug/".
Done Building Project "[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj" (default targets) -- FAILED.
Done Building Project "[…]/eto-test/eto-test.sln" (default targets) -- FAILED.

Build FAILED.

"[…]/eto-test/eto-test.sln" (default target) (1) ->
"[…]/eto-test/eto-test/eto-test.fsproj" (default target) (2) ->
(ReportAssetsLogMessages target) -> 
  /usr/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '[…]/eto-test/eto-test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [[…]/eto-test/eto-test/eto-test.fsproj]


"[…]/eto-test/eto-test.sln" (default target) (1) ->
"[…]/eto-test/eto-test/eto-test.fsproj" (default target) (2) ->
(RunResolvePackageDependencies target) -> 
  /usr/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '[…]/eto-test/eto-test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [[…]/eto-test/eto-test/eto-test.fsproj]

    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:01.66

System

Fedora 27 x86_64.

dnf repository-packages packages-microsoft-com-prod list installed gibt zurück:

aspnetcore-store-2.0.0.x86_64            2.0.0-1             @packages-microsoft-com-prod
aspnetcore-store-2.0.3.x86_64            2.0.3-1             @packages-microsoft-com-prod
dotnet-host.x86_64                       2.0.6-1             @packages-microsoft-com-prod
dotnet-hostfxr-2.0.3.x86_64              2.0.3-1             @packages-microsoft-com-prod
dotnet-runtime-2.0.3.x86_64              2.0.3-1             @packages-microsoft-com-prod
dotnet-sdk-2.0.3.x86_64                  2.0.3-1             @packages-microsoft-com-prod

dnf repository-packages mono-centos7-stable list installed gibt zurück:

fsharp.noarch              4.1.33-0.xamarin.2.epel7                               @mono-centos7-stable
libgdiplus0.x86_64         4.2-0.xamarin.2.epel7                                  @mono-centos7-stable
libmonosgen-2_0-1.x86_64   5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-core.x86_64           5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-data.x86_64           5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-data-oracle.x86_64    5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-data-sqlite.x86_64    5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-devel.x86_64          5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-extras.x86_64         5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-mvc.x86_64            5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-wcf.x86_64            5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-web.x86_64            5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-winforms.x86_64       5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
mono-winfxcore.x86_64      5.10.1.20-0.xamarin.3.epel7                            @mono-centos7-stable
msbuild.noarch             1:15.4+xamarinxplat.2017.11.27.11.23-0.xamarin.1.epel7 @mono-centos7-stable
msbuild-libhostfxr.x86_64  2.0.0.2017.07.06.00.01-0.xamarin.1.epel7               @mono-centos7-stable
msbuild-sdkresolver.noarch 1:15.4+xamarinxplat.2017.11.27.11.23-0.xamarin.1.epel7 @mono-centos7-stable
nuget.noarch               2.12+mono-0.xamarin.3.epel7                            @mono-centos7-stable

Der Fehler sagt Ihnen bereits, was falsch ist ... "Führen Sie eine NuGet-Paketwiederherstellung aus, um diese Datei zu generieren.", und nein, dies bedeutet nicht, dass Sie nuget restore ausführen, dieser Befehl funktioniert nicht so. Die einfachste Lösung ist, dotnet restore auszuführen.

Laut der Dokumentation zu Package Restore wird es auch von nuget restore ausgelöst. Jedenfalls führt das Ausführen dotnet restore zu einem Teilfehler:

[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj(57,3): error MSB4020: The value "" of the "Project" attribute in element <Import> is invalid.
[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj : warning NU1503: Skipping restore for project '[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj'. The project file may be invalid or missing targets required for restore. [[…]/eto-test/eto-test.sln]
[…]

Dies scheint zu Problemen beim Ausführen msbuild zu führen:

/usr/lib/mono/fsharp/Microsoft.FSharp.Targets(181,9): error MSB4062: The "FSharpEmbedResXSource" task could not be loaded from the assembly /usr/lib/mono/fsharp/FSharp.Build.dll.  Confirm that the <UsingTask> 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. [[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj]
Done Building Project "[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj" (default targets) -- FAILED.
Done Building Project "[…]/eto-test/eto-test.sln" (default targets) -- FAILED.

Build FAILED.

"[…]/eto-test/eto-test.sln" (default target) (1) ->
"[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj" (default target) (3) ->
(GenerateFSharpTextResources target) -> 
  /usr/lib/mono/fsharp/Microsoft.FSharp.Targets(181,9): error MSB4062: The "FSharpEmbedResXSource" task could not be loaded from the assembly /usr/lib/mono/fsharp/FSharp.Build.dll.  Confirm that the <UsingTask> 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. [[…]/eto-test/eto-test.Desktop/eto-test.Desktop.fsproj]

    0 Warning(s)
    1 Error(s)

Laut der Dokumentation zur Paketwiederherstellung wird es auch durch die Nuget-Wiederherstellung ausgelöst.

nuget restore benötigt Argumente, damit das Wiederherstellungsverzeichnis und die Projektdatei funktionieren, das ist es, wovon ich spreche, Sie können es nicht ohne sie ausführen (es sei denn, es wurde zufällig geändert).

Es sieht so aus, als ob das Problem in meinem Fall darin besteht, dass $(FSharpTargetsPath) leer ist. Es ist nicht überraschend, da die Datei .fsproj beim Festlegen dieser Variablen anzunehmen scheint, dass Visual Studio installiert ist:

<Choose>
  <When Condition="'$(VisualStudioVersion)' == '11.0'">
    <PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets') ">
      <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
    </PropertyGroup>
  </When>
  <Otherwise>
    <PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') ">
      <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
    </PropertyGroup>
  </Otherwise>
</Choose>

Ja, es könnte eine gute Idee sein, als Testfall eine saubere VM mit Dotnet-Kern und Mono auszuführen, um zu sehen, welche Dinge Sie wirklich brauchen, um dies zu erstellen.

@cra0zy dotnet restore unterstützt keine packages.config, die von den F#-Vorlagen benötigt wird. Ich habe jedoch gerade festgestellt, dass die Vorlagen auf nuget nicht auf 2.4.1 aktualisiert wurden (sie befinden sich auf 2.4.0), weshalb ich die Anforderung von packages.config entfernt habe, da die F#-Tools sie jetzt ordnungsgemäß unterstützen.

Sollte mit #1104 behoben werden.

Danke, dass Sie das Problem gemeldet haben!

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen