【问题标题】:Can ASP.NET target .net core?ASP.NET 可以针对 .net 核心吗?
【发布时间】:2020-03-01 19:01:59
【问题描述】:
我刚刚被添加到一个以netcoreapp3.1 为目标的项目中。
我可以看到 bit framework 包已添加到项目中。
问题是这个包(位框架)似乎使用 asp.net(不是 asp.net 核心)
另一方面,asp.net 项目不能针对 .net 核心平台。
那么,一个以 .net core 为目标的项目怎么可能依赖于使用 asp.net classic 的库呢?
我错过了什么?
【问题讨论】:
标签:
asp.net
asp.net-core
bit-framework
【解决方案1】:
Bit.Core 项目目标
- .Net Framework 4.6.1
- .Net Core 3.1
你可以在项目文件中看到
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Server.Build.props" />
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<PackageTags>$(PackageTags)</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="Autofac" Version="5.1.2" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
</Project>
【解决方案2】:
您可以将 net core app 3.1 & asp.net core 3.1 和 net461+ 与 asp.net core 2.2 一起定位
你可以看看this example。