I can build with dotnet
I can't build with dotnet
[alan@localhost Testing]$ dotnet new etoapp -g -sln
The template "Eto App" was created successfully.
[alan@localhost 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@localhost 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)
In particular this line seems important.
The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild.
Thanks for reporting the issue. However you need to use msbuild
Instead of dotnet build
.
That worked. When I tried the same thing for F#
dotnet new etoapp -g -sln -lang F#
then I get
/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)
with msbuild.
We should probably add that into the quickstart guide that you can't use dotnet build.
@voronoipotato nuget restore
.
NuGet command should be installed with mono-complete, but if it doesn't you can install it separately.
If you only need to support Linux platform you could use Eto.Platform.Gtk
nuget and target netcoreapp2.0 and you will be able to build using dotnet build
Here is an example of my 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>
Note: This is not recommended, because some features are missing or don't work on net core, for example WebView
. @cra0zy could tell you about this more.
@voronoipotato Build the .csproj file, not the solution file. Solution seems to contain the Mac project, and that will always fail to build on Linux.
Note: This is not recommended, because some features are missing or don't work on net core, for example WebView. @cra0zy could tell you about this more.
No.... everything works on .NET Core including WebView.
Solution seems to contain the Mac project, and that will always fail to build on Linux.
Actually, that is incorrect. The mac projects(s) no longer use the deprecated MonoMac project type and use the sdk-style csproj. Eto's nuget packages now include .targets files that will build the .app bundle for you even on Windows or Linux. However, the optional Xamarin.Mac project will still only build on a Mac.
We should probably add that into the quickstart guide that you can't use dotnet build
Done! I've added nuget restore
and msbuild
to the example to point people in the right direction there.
Ah, I thought he was generating the per platform solutions, still haven't really tried out the new templates.
@voronoipotato is this working for you now using nuget/msbuild?
I've also created #1080 to port the .targets files to support dotnet build
in the future.
I too am not able to build a trivial case.
mkdir -p eto-test
cd eto-test
dotnet new -i "Eto.Forms.Templates::*"
dotnet new etoapp -lang F#
nuget restore
msbuild
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
Fedora 27 x86_64.
dnf repository-packages packages-microsoft-com-prod list installed
returns:
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
returns:
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
The error already tells you whats wrong... "Run a NuGet package restore to generate this file.", and no, this does not mean run nuget restore
, that command does not work that way. Easiest solution is to run dotnet restore
.
According to the documentation on Package Restore, it is triggered also by nuget restore
. Anyway, running dotnet restore
results in a partial error:
[…]/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]
[…]
This seems to lead to problems when running 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)
According to the documentation on Package Restore, it is triggered also by nuget restore.
nuget restore
needs arguments for the restore dir and project file to work, thats what I'm talking about, you can't run it without them (unless it got changed by any chance).
It looks like the problem in my case is that $(FSharpTargetsPath)
is empty. It is unsurprising, as .fsproj
file, when setting this variable, seems to assume that Visual Studio is installed:
<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>
yes it might be a good idea as a test case to run against a clean vm with dotnet core and mono to see what things you really need to build this.
@cra0zy dotnet restore
does not support packages.config, which is needed by the F# templates. However, I just realized that the templates on nuget haven't been updated to 2.4.1 (they are at 2.4.0), which I removed the packages.config requirement as F# tooling now supports it properly.
Should be fixed with #1104.
Thanks for reporting the issue!
Most helpful comment
@voronoipotato Build the .csproj file, not the solution file. Solution seems to contain the Mac project, and that will always fail to build on Linux.
No.... everything works on .NET Core including WebView.