Setting Core Framework
See original GitHub issueIt 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:
-
List installed frameworks:
dotnet
core
-
Target a framework:
dotnet
core
current
-
Create a project with targeted framework:
dotnet
new
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (4 by maintainers)
…or
sdk
?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 currentdotnet
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 withnvm
(alarvm
with Ruby) and the process can read version if respected by templating tool at runtime.