[英]Create new ASP.NET Core project that targets .NET Framework by DotNet CLI
I try to create a new ASP.NET Core project that target the classic .NET Framework.我尝试创建一个针对经典 .NET 框架的新 ASP.NET 核心项目。 The template web and webapi have the option
framework
, but this don't accept .NET Framework value like:模板web和webapi具有选项
framework
,但这不接受 .NET 框架值,例如:
dotnet new web --name MyWebProject --framework net48
Error: Invalid parameter(s):
错误:无效参数:
--framework net48--framework net48
'net48' is not a valid value for --framework (Framework).'net48' 不是 --framework(框架)的有效值。
How create ASP.NET Core project that targets .NET Framework from DotNet CLI?如何从 DotNet CLI 创建针对 .NET 框架的 ASP.NET 核心项目?
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. PS:我知道Visual Studio模板
ASP.NET Core empty
让select .NET框架。 I search a solution from command line, preferably with DotNet CLI.我从命令行搜索解决方案,最好使用 DotNet CLI。
I used this to create ASP.NET Core empty Web App that targets 4.7.1:我用它来创建针对 4.7.1 的 ASP.NET 核心空 Web 应用程序:
dotnet new web --target-framework-override net471
I saw it there .我在那里看到了。 The generated project file looks like this:
生成的项目文件如下所示:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
</ItemGroup>
</Project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.