question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is prefercliruntime the preferred solution for CLI tools?

See original GitHub issue

Related: https://github.com/fable-compiler/Fable/issues/961#event-1099667439

Hi there! Recently a user has reported a problem with dotnet-fable CLI tool as apparently the tool won’t run if the user has a lower dotnet SDK (and thus coreclr runtime) patch version than the one used to build it. This behavior doesn’t look very intuitive as netcoreapp target frameworks don’t include a patch version (netcoreapp1.0, netcoreapp1.1), and one would expect the tool to work with all coreclr 1.0.x runtimes, or at least to be able to set the minimum patch version explicitly instead of letting MSBuild do it for you.

However, @enricosada has explained to me the tradeoffs for CLI tools and suggested to use a prefercliruntime file to avoid the error. The question then is: is this the preferred solution for all CLI tools? If so, could it be documented somewhere, added to CLI tools templates, improve the error message users see when it’s missing, etc?

Thanks a lot for your help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
enricosadacommented, Jun 17, 2017

runtime 1.1.0? I thought CLI tools couldn’t target necoreapp1.1

i think when running it on os with just 1.1, will just pass --fx-version 1.1 argument of dotnet exec to override what runtime use.

@dsplaisted told me the name of the MSBuild property to set the runtime version but I forgot it and couldn’t find it in the documentation. Which one is it and how is it used?

@alfonsogarciacaro grepping dotnet msbuild /pp > logpp.txt

  <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETStandard'" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PackageReference Include="NETStandard.Library" Version="$(NetStandardImplicitPackageVersion)" IsImplicitlyDefined="true" />
  </ItemGroup>
  <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PackageReference Include="Microsoft.NETCore.App" Version="$(RuntimeFrameworkVersion)" IsImplicitlyDefined="true" />
  </ItemGroup>

so $(RuntimeFrameworkVersion) for Microsoft.NETCore.App, and $(NetStandardImplicitPackageVersion) for netstandard.library packages

1reaction
livarcocccommented, Nov 22, 2017

Closing this issue since the questions here seem to have been clarified a while ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implicit restore for cli tools · Issue #8756 · dotnet/sdk
dotnet build now has implicit restore and it's considered a good thing. Unfortunately we don't have it for cli tools.
Read more >
Why use Rust over Python for CLI?
I am a firm believer in the right tools for the job. While learning Rust I have read it has become a favourite...
Read more >
Best Practices Building a CLI Tool for Your Service
Using CLI tools help developers move faster. Part of that magic is ensuring that the tool can meet the developer's exact needs, which...
Read more >
My Favorite CLI Tools
My Favorite CLI Tools ; fish shell - easy to use, beginner-friendly shell ; starship - a great prompt that requires no setup...
Read more >
Command Line Interface: Pros and Cons
Even though it might seem complex, over 70% of experienced developers prefer CLIs for their direct control and speed. In this article, we'll ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found