完整.NET Framework上的ASP.NET Core 2.1 [英] ASP.NET Core 2.1 on full .NET Framework

查看:66
本文介绍了完整.NET Framework上的ASP.NET Core 2.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用ASP.NET Core 2.1并仍在完整的.NET Framework 4.7.1上运行?

Is it possible to use ASP.NET Core 2.1 and still run on the full .NET Framework 4.7.1?

我目前在.NET 4.7.1上使用ASP.NET Core 2.0,并且还在4.7.1上使用Azure Functions v1,并在Functions和Web项目之间共享类库.

I'm currently using ASP.NET Core 2.0 on .NET 4.7.1 and i'm also using Azure Functions v1 on 4.7.1 and share Class Librarys between the Functions- and the Web Projects.

考虑到Azure Functions v2的当前状态,升级到Azure Functions v2以便在.NET Core上全押似乎有些冒险,因此我宁愿现在停留在.NET Framework上.

Upgrading to Azure Functions v2 to go all-in on .NET Core seems a bit too risky given the current state of Azure Functions v2 so i would prefer staying on .NET Framework for now.

推荐答案

是.

元软件包 Microsoft.AspNetCore.App Microsoft.AspNetCore.All 需要 netcoreapp ,但它们只是其他软件包的集合安装.

The metapackages Microsoft.AspNetCore.App and Microsoft.AspNetCore.All require netcoreapp, but the they are just a collection of other packages to install.

如果您将单个软件包安装在metapackage中,则可以正常工作,就像您当前使用的是2.0

If you install the individual packages in the metapackage, it'll work fine, just like you currently have with 2.0

您的.csproj文件最终看起来与此相似...

Your .csproj file will end up looking similar to this...

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net471</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.1.1" />
    ...

请注意一些软件包,例如 Microsoft.AspNetCore.Http.Connections 标记为2.1.1,因此您需要确保匹配元包约束中的版本.

Just notice that some packages, eg. Microsoft.AspNetCore.Http.Connections are not tagged to 2.1.1, so you need to make sure you match the versions from the metapackage constraints.

这篇关于完整.NET Framework上的ASP.NET Core 2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆