jburzynski / TypeGen

Single-class-per-file C# to TypeScript generator
MIT License
186 stars 54 forks source link

CLI <= v2.4.6 requires DotNetCore 2.2 #81

Closed vsvirydau-cl closed 4 years ago

vsvirydau-cl commented 4 years ago

Running dotnet tool install --global TypeGen.DotNetCli --version 2.4.4 produces the following:

The settings file in the tool's NuGet package is invalid: Settings file 'DotnetToolSettings.xml' was not found in the package.
Tool 'typegen.dotnetcli' failed to install. Contact the tool author for assistance.

Failed both on Ubuntu 19 and Windows 10

I've tried following the 3.0 way of installing tools by running dotnet new tool-manifest && dotnet tool install TypeGen.DotNetCli and it fails with same error.

vsvirydau-cl commented 4 years ago

I noticed that the .nupkg file downloaded from nuget site has a folder tools\netcoreapp3.0\any but it only contains a 0-sized file called _._ and is missing all of the files that are located under tools\netcoreapp2.2\any, which includes DotnetToolSettings.xml

vsvirydau-cl commented 4 years ago

Was able to install v2.4.2

The .nupkg does not have tools\netcoreapp3.0, so it probably downgrades automatically.

jburzynski commented 4 years ago

Thanks for posting! I just fixed it in 2.4.5 (that is actually the only change in this version).

vsvirydau-cl commented 4 years ago

Hey, it installs now, but if you try to run it on a machine that doesn't have 2.2 it would fail... Perhaps the netcoreapp3.0 folder should have a copy of the dll's?

jburzynski commented 4 years ago

I just found this doc - have you tried using the --fx-version <VERSION> option to try to run it with .NET Core 2.2 (I haven't tried it and I'm not even sure this would solve the problem)?

I wouldn't want to put the same dlls in netcoreapp3.0, because this might be misleading (the dlls are not actually .NET Core 3 etc.).

I'll be upgrading TypeGen to .NET Core 3 at some point and then I'll include proper .NET Core 3 files - but this requires some investigation, because compilation output is slightly different in .NET Core 3 and some adaptation will be needed.

vsvirydau-cl commented 4 years ago

I'm not sure if --fx-version is applicable to dotnet tool command...

Does it actually fail to build under 3.0? Could it be made to target a more common denominator like DotNetStandard instead?

jburzynski commented 4 years ago

The .NET CLI tool is an actual application, so it can't be .NET Standard.

It should build for .NET Core 3, but there will probably be some adjusting because .NET Core 3 outputs an exe now instead of a dll, so I'd have to change scripts, directory contents etc. and check if it works, and right now I don't have time to do this.

I will be upgrading to .NET Core 3, but some time later.

vsvirydau-cl commented 4 years ago

Ok, thanks for the clarification. I'll leave the issue open, so I can get notified when it's ready.

jburzynski commented 4 years ago

Definitely, I'll keep you updated.

jburzynski commented 4 years ago

.NET Core 3.0 support added in version 2.4.7. If something doesn't work, please let me know in this issue.

vsvirydau-cl commented 4 years ago

So, I've uninstalled dotnet-sdk-22 package, nuked $HOME/.nuget, did dotnet restore and dotnet tool restore.

$ dotnet --list-sdks
3.0.100 [/usr/share/dotnet/sdk]

This is what I get when I run it:

dotnet -d tool run dotnet-typegen 
Telemetry is: Disabled
Running /usr/share/dotnet/dotnet $HOME/.nuget/packages/typegen.dotnetcli/2.4.7/tools/netcoreapp2.2/any/TypeGen.Cli.dll
It was not possible to find any compatible framework versionProcess ID: 24962

The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
  - The following frameworks were found:
      3.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download
vsvirydau-cl commented 4 years ago

Ok, after re-installing 2.2, I ran it and it informed me that I have to install dotnet-typegen as typegen.dotnetcli is outdated. After replacing one with the other it now seemingly goes for 3.0 dlls...