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.

Setting Core Framework

See original GitHub issue

It seems that the framework which a project created by dotnet-new targets depends on the tooling preview installed. Executing dotnet-new with Preview2-1 installed will create a project which targets the 1.1.0 runtime. However if the Preview5 tooling is installed side by side with Preview2-1 then the Preview5 tooling will be used by default and the 1.0.1 runtime is targeted.

As I understand it, Preview5 works happily with the 1.1.0 runtime. However after running dotnet-new with the Preview5 tools we have to edit the .csproj file to target the 1.1.0 runtime.

I have checked the docs of global.json to see if dotnet can be configured to target a particular framework when creating a project. global.json can be used to target a particular tooling version. However it seems that which framework gets targeted when running dotnet-new just depends on which tooling is installed.

I would like to propose an addition to the CLI:

  • dotnet core lts

  • dotnet core current

  • dotnet core 1.1.0

  • dotnet core 1.0.3

The idea is that prior to running dotnet-new we can set the target framework.

dotnet core lts -targets the most recent LTS framework of the installed frameworks.

dotnet core current -targets the most recently installed Current branch framework of the installed frameworks.

dotnet core <fx-version-number> -targets a specified framework.

Then running dotnet-new the resulting project will target the chosen framework.

Or it could be an option in for the dotnet-new command:

  • dotnet new -core current

Running dotnet should list more than just a version. dotnet should know which frameworks are installed and list the following:

Targeted Version : X.X.X Build : xxxxxxxxxxxxxxxxxxxxxxxx

LTS Version : X.X.X Build : xxxxxxxxxxxxxxxxxxxxxxxx

Current Version : X.X.X Build : xxxxxxxxxxxxxxxxxxxxxxxx

Targeted version is the version set using my proposed dotnet core command. LTS and Current are the most recent frameworks installed of each branch, which dotnet has discovered. Whether a framework version is a LTS or Current branch release should be declared somewhere in the installed framework package, this is then discoverable by dotnet

I believe the Version which is currently displayed when running dotnet is the most recent framework installed. However this is confusing because if it’s 1.1.0 and you have Preview5 tools, then it’s not used when running the dotnet-new command, instead 1.0.1 is targeted. You might expect this. But it’s not used when running a project either, the project simply runs on whichever framework it targets… So why show this version??

Perhaps just running the dotnet core command without arguments could list all the installed frameworks, so we don’t have to browse the file system to remember what we have installed. Then we can set a target framework.

I quite like the idea of the command being called core but it could also be fx or something different. If it were just an option for the dotnet-new command it could be -fx-version <ver num> instead of -core.

The framework targeted could revert to the default, (possibly LTS?), upon beginning a fresh session.

I like this idea of dotnet being aware of the latest LTS and Current branch frameworks installed so that it is natural to have multiple frameworks installed, have the information about those installed frameworks made readily available by the CLI and for it to be easy, simple and safe to switch between frameworks in a development workflow. This way developers can always be trying out the latest bits, comfortably and confident that there won’t be any interference.

At the moment the version number displayed is misleading, there seems to be no support for choosing a framework to target, and the experience is opaque regarding which frameworks are installed and available.

We should be able to:

  1. List installed frameworks: dotnet core

  2. Target a framework: dotnet core current

  3. Create a project with targeted framework: dotnet new

cc @blackdwarf @shanselman @coolcsh @DamianEdwards

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Antariscommented, Dec 19, 2016

…or sdk?

1reaction
peterblazejewiczcommented, Jan 18, 2017

I hope it would not be too complicated and perplexing for users (--framework (-f/--framework), --version, --core-version, --runtime, --list, --info, --sdk). I would like to just be able to select current dotnet version a’la old-good dnvm, having option to use more then one runtime (--current/--lts). When doing Node based projects I could set version with nvm (ala rvm with Ruby) and the process can read version if respected by templating tool at runtime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and Configuring a Model - EF Core
Overview of creating and configuring a Entity Framework Core model via Fluent API, Data Annotations and conventions.
Read more >
Configuration in ASP.NET Core
Learn how to use the Configuration API to configure AppSettings in an ASP.NET Core app.
Read more >
.NET core vs .NET framework
Wondering about the difference between .NET Core & .NET Framework? Here's a quick guide on how to pick the right runtime environment for...
Read more >
.NET Core Overview
It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems. .NET Core Framework can be used to build different...
Read more >
.NET Core vs .NET Framework vs .NET Standard: A Guided ...
A guide for understanding the differences between .NET, .NET Core, .NET Framework, .NET Standard, etc. by exploring the history of the platform.
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