Eto: Tidak dapat membuat kasus sepele di linux

Dibuat pada 6 Apr 2018  ·  16Komentar  ·  Sumber: picoe/Eto

Perilaku yang Diharapkan

Saya bisa membangun dengan dotnet

Perilaku Sebenarnya

Saya tidak bisa membangun dengan dotnet

Langkah-langkah untuk Mereproduksi Masalah

  1. instal dotnet-sdk-2.0.0
  2. instal mono-devel
  3. instal mono-lengkap
  4. dotnet new -i "Eto.Forms.Templates::*"
  5. dotnet etoapp baru -g -sln
  6. pemulihan dotnet
  7. membangun dotnet

Kode yang Menunjukkan Masalah

[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)

Secara khusus baris ini tampaknya penting.
The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild.

spesifikasi

  • Versi: 2.4.0
  • Platform: (Fedora Gtk3)

Komentar yang paling membantu

@voronoipotato Bangun file .csproj, bukan file solusi. Solusi tampaknya berisi proyek Mac, dan itu akan selalu gagal dibangun di Linux.

Catatan: Ini tidak disarankan, karena beberapa fitur hilang atau tidak berfungsi pada inti bersih, misalnya WebView. @cra0zy dapat memberi tahu Anda tentang ini lebih lanjut.

Tidak.... semuanya bekerja di .NET Core termasuk WebView.

Semua 16 komentar

Terima kasih telah melaporkan masalah ini. Namun Anda perlu menggunakan msbuild Alih-alih dotnet build .

Itu berhasil. Ketika saya mencoba hal yang sama untuk F#
dotnet new etoapp -g -sln -lang F#
maka saya mendapatkan

/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)

dengan msbuild.

Kami mungkin harus menambahkannya ke dalam panduan memulai cepat bahwa Anda tidak dapat menggunakan dotnet build.

@voronoipotato nuget restore .
Perintah NuGet harus diinstal dengan mono-complete, tetapi jika tidak, Anda dapat menginstalnya secara terpisah.

Jika Anda hanya perlu mendukung platform Linux, Anda dapat menggunakan Eto.Platform.Gtk nuget dan menargetkan netcoreapp2.0 dan Anda akan dapat membangun menggunakan dotnet build

Berikut ini contoh csproj saya:

<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>

Catatan: Ini tidak disarankan, karena beberapa fitur hilang atau tidak berfungsi pada inti bersih, misalnya WebView .

@voronoipotato Bangun file .csproj, bukan file solusi. Solusi tampaknya berisi proyek Mac, dan itu akan selalu gagal dibangun di Linux.

Catatan: Ini tidak disarankan, karena beberapa fitur hilang atau tidak berfungsi pada inti bersih, misalnya WebView. @cra0zy dapat memberi tahu Anda tentang ini lebih lanjut.

Tidak.... semuanya bekerja di .NET Core termasuk WebView.

Solusi tampaknya berisi proyek Mac, dan itu akan selalu gagal dibangun di Linux.

Sebenarnya, itu tidak benar. Proyek mac tidak lagi menggunakan jenis proyek MonoMac yang tidak digunakan lagi dan menggunakan csproj gaya sdk. Paket nuget Eto sekarang menyertakan file .targets yang akan membangun .app bundle untuk Anda bahkan di Windows atau Linux. Namun, proyek Xamarin.Mac opsional masih hanya akan dibangun di Mac.

Kami mungkin harus menambahkannya ke dalam panduan memulai cepat bahwa Anda tidak dapat menggunakan dotnet build

Selesai! Saya telah menambahkan nuget restore dan msbuild ke contoh untuk mengarahkan orang ke arah yang benar di sana.

Ah, saya pikir dia menghasilkan solusi per platform, masih belum benar-benar mencoba template baru.

@voronoipotato apakah ini berfungsi untuk Anda sekarang menggunakan nuget/msbuild?

Saya juga telah membuat #1080 untuk mem-port file .targets untuk mendukung dotnet build di masa mendatang.

Saya juga tidak bisa membangun kasus sepele.

Langkah-langkah untuk mereproduksi

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

Apa yang terjadi

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

Sistem

Fedora 27x86_64.

dnf repository-packages packages-microsoft-com-prod list installed mengembalikan:

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 mengembalikan:

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

Kesalahan sudah memberi tahu Anda apa yang salah ... "Jalankan pemulihan paket NuGet untuk menghasilkan file ini.", dan tidak, ini tidak berarti jalankan nuget restore , perintah itu tidak berfungsi seperti itu. Solusi termudah adalah menjalankan dotnet restore .

Menurut dokumentasi di Package Restore , itu juga dipicu oleh nuget restore . Bagaimanapun, menjalankan dotnet restore menghasilkan kesalahan sebagian:

[…]/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]
[…]

Ini tampaknya menyebabkan masalah saat menjalankan msbuild :

/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)

Menurut dokumentasi di Package Restore, itu dipicu juga oleh nuget restore.

nuget restore membutuhkan argumen agar direktori pemulihan dan file proyek berfungsi, itulah yang saya bicarakan, Anda tidak dapat menjalankannya tanpa mereka (kecuali jika diubah secara kebetulan).

Sepertinya masalah dalam kasus saya adalah $(FSharpTargetsPath) kosong. Tidak mengherankan, karena file .fsproj , saat mengatur variabel ini, tampaknya mengasumsikan bahwa Visual Studio diinstal:

<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>

ya itu mungkin ide yang baik sebagai kasus uji untuk dijalankan melawan vm bersih dengan dotnet core dan mono untuk melihat hal-hal apa yang benar-benar Anda perlukan untuk membangun ini.

@cra0zy dotnet restore tidak mendukung package.config, yang dibutuhkan oleh template F#. Namun, saya baru menyadari bahwa templat di nuget belum diperbarui ke 2.4.1 (ada di 2.4.0), yang saya hapus dari persyaratan package.config karena perkakas F# sekarang mendukungnya dengan benar.

Harus diperbaiki dengan #1104.

Terima kasih telah melaporkan masalah ini!

Apakah halaman ini membantu?
0 / 5 - 0 peringkat