Hubert-Rybak / dotnet-warp

.NET Core global tool for producing single executable using Warp
MIT License
249 stars 23 forks source link

Won't compile on .NET Core 3.0 #38

Closed ghost closed 5 years ago

ghost commented 5 years ago

the output exe/dll from a normal publish works, however.

D:\Project> dotnet warp -v                                                                                               Running Publish...                                                                                                      Running dotnet publish -c Release -r win-x64 -o "D:\Project\dotnetwarp_temp" "D:\Project"
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 67.4 ms for D:\Project\Project.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  Project-> D:\Project\bin\Release\netcoreapp3.0\win-x64\Project.dll
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(88,13): error MSB4064: The "ReferenceAssemblyPaths" parameter is not supported by the "ILLink" task. Verify the parameter exists on the task, and it is a settable public instance property. [D:\Project\Project.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(87,5): error MSB4063: The "ILLink" task could not be initialized with its input parameters.  [D:\Project\Project.csproj]

Publish failed. Set --verbose flag for more info.
D:\Project> dotnet warp -v -l Normal                                                                                     Running AddLinkerPackage...                                                                                             Running dotnet add package --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json ILLink.Tasks -v 0.1.5-preview-1841731
  Writing C:\Users\User\AppData\Local\Temp\tmpDBD1.tmp
info : Adding PackageReference for package 'ILLink.Tasks' into project 'D:\Project\Project.csproj'.
info : Restoring packages for D:\Project\Project.csproj...
info : Package 'ILLink.Tasks' is compatible with all the specified frameworks in project 'D:\Project\Project.csproj'.
info : PackageReference for package 'ILLink.Tasks' version '0.1.5-preview-1841731' updated in file 'D:\Project\Project.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: D:\Project\obj\project.assets.json
log  : Restore completed in 68.07 ms for D:\Project\Project.csproj.

Running Publish...
Running dotnet publish -c Release -r win-x64 -o "D:\Project\dotnetwarp_temp" "D:\Project"
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 16.84 ms for D:\Project\Project.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  Project -> D:\Project\bin\Release\netcoreapp3.0\win-x64\Project.dll
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(88,13): error MSB4064: The "ReferenceAssemblyPaths" parameter is not supported by the "ILLink" task. Verify the parameter exists on the task, and it is a settable public instance property. [D:\Project\Project.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(87,5): error MSB4063: The "ILLink" task could not be initialized with its input parameters.  [D:\Project\Project.csproj]

Publish failed. Set --verbose flag for more info.
Delevin888 commented 5 years ago

i think you can add /p:PublishSingleFile=true after dotnet command like :dotnet publish -c release -r linux-x64 /p:PublishSingleFile=true, Instead of using dotnet-warp at .net core 3.0

Hubert-Rybak commented 5 years ago

Yep, .NET Core 3.0 has this mechanism built in. So it would be: dotnet publish -c Release -r linux-x64 /p:PublishSingleFile=true /p:PublishTrimmed=true

Running external ILLink.Tasks on .NET Core 3.0 is not supported

Note: In previous versions of .NET Core, ILLink.Tasks was shipped as an external NuGet package and provided much of the same functionality. It is no longer supported – please update to the .NET Core 3.0 SDK and try the new experience!

Source: https://devblogs.microsoft.com/dotnet/announcing-net-core-3-0/

trampster commented 5 years ago

Yes but according to scott hanselman, this tool can get to 9 MB binaries but the dotnet core 3.0 trimmer only gets me to 30 MB.

So dotnet-warp is way better, you should make it work with dotnet core 3.0

Hubert-Rybak commented 5 years ago

ILLink.Tasks package, which dotnet-warp uses to pack, is not working on .NET Core 3.0. There is nothing I can do to make it work, as it was obsoleted for a reason - there is already built in mechanism for that. Sadly, ILLink.Tasks package was more configurable, and more aggresive trimming was possible. You could try approach given here: https://www.hanselman.com/blog/MakingATinyNETCore30EntirelySelfcontainedSingleExecutable.aspx

ghost commented 5 years ago

Thanks!