[英]How to reference ASP.NET Core 6 types in .net 6 library?
I am working on internal libraries for my organization.我正在为我的组织开发内部库。 I need to reference certain types that normally "belong" to web apps, eg.我需要引用通常“属于”web 应用程序的某些类型,例如。 to provide some extensions:提供一些扩展:
WebApplicationOptions
HttpContext
If I use <Project Sdk="Microsoft.NET.Sdk">
, i don't have references to these types and can't find any nuget package which contains them.如果我使用<Project Sdk="Microsoft.NET.Sdk">
,我没有对这些类型的引用,也找不到包含它们的任何 nuget package。 If i use <Project Sdk="Microsoft.NET.Sdk.Web">
, i can't build my class library because it is treated as application and has to specify entry point.如果我使用<Project Sdk="Microsoft.NET.Sdk.Web">
,我无法构建我的 class 库,因为它被视为应用程序并且必须指定入口点。
So, my question in general: what is the right way to write libraries for ASP.NET Core 6?所以,我的一般问题是:为 ASP.NET Core 6 编写库的正确方法是什么?
Back in core 2.x days there were packages for everything, like Microsoft.AspNetCore.Http.Abstractions
.回到核心 2.x 时代,所有东西都有包,比如Microsoft.AspNetCore.Http.Abstractions
。 They are all stuck at version 2.2.0
and i assume they're not usable now?它们都停留在2.2.0
版本,我认为它们现在无法使用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.