-
-
Notifications
You must be signed in to change notification settings - Fork 1k
update console app templating #1632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update console app templating #1632
Conversation
@adamsitnik and @am11, can you also verify the finding regard to upgrading the referenced version to 0.12.1? |
Thanks. Yes it needs 0.12.1 for net5.0 support, as 0.12.0 lacks it. |
<PropertyGroup Condition="'$(consoleApp)' == 'true'"> | ||
<TargetFramework>$(Frameworks)</TargetFramework> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(consoleApp)' == 'false'"> | ||
<TargetFrameworks>$(Frameworks)</TargetFrameworks> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<PlatformTarget>AnyCPU</PlatformTarget> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we always have a single target framework?
<PropertyGroup Condition="'$(consoleApp)' == 'true'"> | |
<TargetFramework>$(Frameworks)</TargetFramework> | |
<OutputType>Exe</OutputType> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(consoleApp)' == 'false'"> | |
<TargetFrameworks>$(Frameworks)</TargetFrameworks> | |
</PropertyGroup> | |
<PropertyGroup> | |
<PlatformTarget>AnyCPU</PlatformTarget> | |
<PropertyGroup Condition="'$(consoleApp)' == 'true'"> | |
<OutputType>Exe</OutputType> | |
</PropertyGroup> | |
<PropertyGroup> | |
<TargetFramework>$(Frameworks)</TargetFramework> | |
<PlatformTarget>AnyCPU</PlatformTarget> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @adamsitnik , it could be multiple target frameworks.
However, dotnet run
will throw error without the framework option if there were multiple target frameworks, which may not be ideal for user experience.
Plus, I guess it will be rare that developers want to have multiple target frameworks when building a console app to run benchmark. unless I was wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can user specify multiple target frameworks when creating a new project from template? If not, we should simplify it and users can always modify it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @adamsitnik. Templates like dotnet new console
or dotnet new classlib
(and the projects created by VS templates) just offer <TargetFramework>
(singular). Users can choose to modify project files based on their own requirement.
ps: on the topic of keeping things simple, it would be very intuitive for dotnet
cli users if dotnet new benchmark.console
and dotnet new benchmark.classlib
are separated, rather than expecting --console-app true
with classlib variant as default. At the very least, we should prefer --console
flag (presence means yes, absence means no) instead of two-worded option with mandatory boolean value. (we are still in version 0.x, so breaking changes will not be frowned upon by end users)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @adamsitnik, I think for the classlib, it supports multiple templates, and it is been implemented initially, so I just bring it back in this pull request.
but as @am11 mentioned, the console
and classlib
ones from Microsoft generates TargetFramework
.
I will made the change, all with single TargetFramework only.
And I think it would be better to address the address the suggestion from @am11 on separate templates in different pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @adamsitnik and @am11 , template are updated with single TargetFramework
for both console and classlib per discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @ExceptionCaught !
* Fix batch file * Update Program.cs * Fix type of framework parameter * Fix docs * Set consoleApp=true by default * Remove outdated info. The parameter was changed in #1632 * Update docs
This is to address the missing output type as mentioned here.
Based on the test on my local. the original issue #1512 is actually fixed by bumping up the referenced version to
0.12.1
.