问题描述
是否可以在使用 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.
如果您在元包中安装单个包,它会正常工作,就像您目前使用 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!