0
votes

I try to create a new ASP.NET Core project that target the classic .NET Framework. The template web and webapi have the option framework, but this don't accept .NET Framework value like :

dotnet new web --name MyWebProject --framework net48

Error: Invalid parameter(s):
--framework net48
'net48' is not a valid value for --framework (Framework).

How create ASP.NET Core project that targets .NET Framework from DotNet CLI?

If it isn't possible, do you know a solution to do this in command line?

PS : I know the Visual Studio template ASP.NET Core empty let select .NET Framework. I search a solution from command line, preferably with DotNet CLI.

1
You CANNOT by definition create a .NET Core project that targets the "full, classic" .NET Framework (neither from the CLI, nor in Visual Studio). That would no longer be a .NET Core project - but instead a "regular" .NET project..... the question is more: WHY would you want to do this??marc_s
I know the Visual Studio template ASP.NET Core empty let select .NET Framework - that statement is false - if you create a new ASP.NET Core (empty) project, you can only select the various .NET Core runtimes - any that you have installed - but you CANNOT pick the full, classic .NET 4.8 as runtime....marc_s
@marc_s, ASP.NET Core is a web framework in .NET Standard. The runtime choice is just a line in csproj. Yes, the web framework's name can be misleading...vernou

1 Answers

1
votes

There is no option to set .net frameworks with a default template. You can view the framework's options by running: dotnet new web --help:

image